* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 40px;
    font-size: 2.5em;
}

h2 {
    color: #555;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.player-input-section {
    margin-bottom: 50px;
}

.ports-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.port-group {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
}

.port-group:hover {
    border-color: #667eea;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.1);
}

.port-title {
    font-size: 1.2em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 15px;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.player-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.player-row:last-child {
    margin-bottom: 0;
}

.player-select {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: white;
    cursor: pointer;
}

.player-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.player-select.drawn {
    background-color: #f0f0f0;
    border-color: #ccc;
    color: #999;
}

.handicap-display {
    min-width: 50px;
    padding: 10px 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-start,
.btn-reset,
.btn-auto,
.btn-spin {
    padding: 15px 40px;
    font-size: 18px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 10px;
    font-weight: bold;
}

.btn-start {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.btn-start:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-auto {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 15px 40px;
    font-size: 18px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 10px;
    font-weight: bold;
}

.btn-auto:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(79, 172, 254, 0.4);
}

.btn-reset {
    background: #f0f0f0;
    color: #666;
}

.btn-reset:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

/* 룰렛 섹션 */
.roulette-section {
    margin-bottom: 50px;
    padding: 30px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 15px;
    text-align: center;
}

.current-player-info {
    margin-bottom: 30px;
}

.current-player-info h3 {
    color: #555;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.current-port {
    font-size: 2em;
    font-weight: bold;
    color: #667eea;
    padding: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

/* 포트 추첨 컨테이너 */
.port-draw-container {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* 플레이어 룰렛 슬롯 */
.player-roulette-slot {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 250px;
    max-width: 300px;
}

.player-roulette-slot .player-name {
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.roulette-wrapper {
    position: relative;
    width: 250px;
    height: 250px;
    margin: 0 auto 15px;
}

.roulette-wrapper canvas {
    border-radius: 50%;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.player-roulette-slot .team-result {
    font-size: 1.5em;
    font-weight: bold;
    padding: 12px;
    border-radius: 10px;
    background: #f5f5f5;
    color: #999;
    transition: all 0.5s ease;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-roulette-slot .team-result.assigned {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}

.player-roulette-slot .team-result.team-sangjoon {
    background: linear-gradient(135deg, #FFD93D, #F6C23E);
    color: #333;
}

.player-roulette-slot .team-result.team-manyeong {
    background: linear-gradient(135deg, #FF6B6B, #FF8E53);
    color: white;
}

.player-roulette-slot .team-result.team-hoon {
    background: linear-gradient(135deg, #4ECDC4, #44A08D);
    color: white;
}

/* HTML 포인터 제거 (캔버스에서 직접 그립니다) */

#rouletteCanvas {
    border-radius: 50%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.btn-spin {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    color: white;
    font-size: 20px;
    padding: 18px 50px;
}

.btn-spin:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 107, 107, 0.4);
}

.btn-spin:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-next-port {
    background: linear-gradient(135deg, #4ECDC4 0%, #44A08D 100%);
    color: white;
    font-size: 20px;
    padding: 18px 50px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    font-weight: bold;
}

.btn-next-port:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(78, 205, 196, 0.4);
}

.progress-info {
    margin-top: 20px;
    font-size: 1.2em;
    color: #555;
    font-weight: bold;
}

.btn-save {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    font-size: 20px;
    padding: 18px 50px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    font-weight: bold;
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(17, 153, 142, 0.4);
}

.btn-restart {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 20px;
    padding: 18px 50px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    font-weight: bold;
}

.btn-restart:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.teams-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.team {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.team:hover {
    transform: translateY(-5px);
}

.team-manyeong {
    border-top: 5px solid #FF6B6B;
}

.team-hoon {
    border-top: 5px solid #4ECDC4;
}

.team-sangjoon {
    border-top: 5px solid #FFD93D;
}

.team h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.4em;
    text-align: center;
}

.team-list {
    list-style: none;
    min-height: 80px;
}

.team-list li {
    background: white;
    padding: 12px 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    font-size: 16px;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.team-list li:last-child {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 15px;
        border-radius: 10px;
    }
    
    /* 상단 링크 */
    .container > div:first-child {
        padding: 5px 10px !important;
        text-align: center !important;
    }
    
    .container > div:first-child a {
        font-size: 14px !important;
        padding: 10px 15px !important;
        display: block !important;
    }
    
    h1 {
        font-size: 1.8em;
        margin-bottom: 20px;
    }
    
    h2 {
        font-size: 1.2em;
    }
    
    .ports-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .port-group {
        padding: 15px;
    }
    
    .player-select {
        font-size: 14px;
        padding: 8px;
    }
    
    .handicap-display {
        font-size: 12px;
        min-width: 40px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-auto, .btn-reset, .btn-start {
        width: 100%;
        font-size: 15px;
        padding: 14px 20px;
        margin-right: 0;
        margin-bottom: 8px;
    }
    
    /* 마지막 버튼의 하단 마진 제거 */
    .action-buttons .btn-reset:last-child,
    .action-buttons .btn-auto:last-child,
    .action-buttons .btn-start:last-child {
        margin-bottom: 0;
    }
    
    .input-grid {
        grid-template-columns: 1fr;
    }
    
    .teams-section {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .team {
        padding: 15px;
    }
    
    .roulette-section {
        padding: 20px 10px;
    }
    
    .roulette-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .player-roulette-slot {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
    
    .player-roulette-slot h3 {
        font-size: 16px;
    }
    
    canvas {
        width: 200px !important;
        height: 200px !important;
    }
    
    .btn-spin, .btn-save, .btn-restart, .btn-next-port {
        width: 100%;
        font-size: 16px;
        padding: 15px 30px;
    }
    
    .progress-info {
        font-size: 16px;
    }
    
    .team-result {
        font-size: 16px;
        padding: 10px;
    }
}
