* {
    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;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* 헤더 */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 30px;
    margin-bottom: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

header h1 {
    color: #2c3e50;
    font-size: 2.5rem;
    font-weight: 700;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

#user-nickname {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1.1rem;
}

#connection-status {
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

#connection-status.connected {
    background: #27ae60;
    color: white;
}

#connection-status.disconnected {
    background: #e74c3c;
    color: white;
}

/* 메인 컨텐츠 */
.main-content {
    position: relative;
}

.screen {
    display: none;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    padding: 30px;
}

.screen.active {
    display: block;
}

/* 로비 화면 */
.lobby-panel h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.controls {
    margin-bottom: 30px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 10px;
}

.btn.primary {
    background: #3498db;
    color: white;
}

.btn.primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn.secondary {
    background: #95a5a6;
    color: white;
}

.btn.secondary:hover {
    background: #7f8c8d;
    transform: translateY(-2px);
}

.btn.danger {
    background: #e74c3c;
    color: white;
}

.btn.danger:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.btn.success {
    background: #27ae60;
    color: white;
}

.btn.success:hover {
    background: #219a52;
    transform: translateY(-2px);
}

.online-users h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.user-card {
    background: white;
    border: 2px solid #ecf0f1;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.user-card:hover {
    border-color: #3498db;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.2);
}

.user-card.waiting {
    border-color: #f39c12;
    background: #fef9e7;
}

.user-card.in-game {
    border-color: #e74c3c;
    background: #fdeaea;
}

.user-card.self {
    border-color: #27ae60;
    background: #eafaf1;
    position: relative;
}

.user-card h4 {
    color: #2c3e50;
    margin-bottom: 5px;
}

.user-card.self h4 {
    margin-bottom: 10px;
}

.name-edit-section {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.name-edit-input {
    padding: 4px 8px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 0.8rem;
    flex: 1;
    min-width: 80px;
}

.name-edit-input:focus {
    outline: none;
    border-color: #27ae60;
}

.name-edit-btn {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    background: #27ae60;
    color: white;
    transition: all 0.2s ease;
}

.name-edit-btn:hover {
    background: #219a52;
}

.name-edit-btn.cancel {
    background: #95a5a6;
}

.name-edit-btn.cancel:hover {
    background: #7f8c8d;
}

.custom-name-display {
    font-size: 0.8rem;
    color: #27ae60;
    font-style: italic;
    margin-top: 4px;
}

.edit-name-trigger {
    font-size: 0.7rem;
    color: #3498db;
    cursor: pointer;
    text-decoration: underline;
    margin-top: 4px;
    display: block;
}

.edit-name-trigger:hover {
    color: #2980b9;
}

.user-status {
    font-size: 0.9rem;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 15px;
}

.user-status.waiting {
    background: #f39c12;
    color: white;
}

.user-status.in-game {
    background: #e74c3c;
    color: white;
}

.user-status.online {
    background: #27ae60;
    color: white;
}

/* 게임 화면 */
.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 30px;
}

.player-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 15px;
    border-radius: 10px;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    min-width: 120px;
}

.player-card.current-turn {
    background: #e8f5e8;
    border: 2px solid #27ae60;
}

.stone {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #2c3e50;
}

.black-stone {
    background: #2c3e50;
}

.white-stone {
    background: white;
}

.player-name {
    font-weight: 600;
    color: #2c3e50;
    text-align: center;
}

.turn-indicator {
    text-align: center;
    padding: 10px 20px;
}

#turn-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
}

.game-controls {
    display: flex;
    gap: 10px;
}

/* 게임 보드 */
.game-board-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #d2b48c;
    border-radius: 10px;
    padding: 20px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
}

#game-board {
    background: #deb887;
    border: 3px solid #8b4513;
    border-radius: 5px;
    cursor: crosshair;
}

.cursor-stone {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10;
    border: 2px solid #2c3e50;
    opacity: 0.6;
    display: none;
}

.cursor-stone.black {
    background: #2c3e50;
}

.cursor-stone.white {
    background: white;
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.modal-content p {
    color: #555;
    margin-bottom: 20px;
    line-height: 1.6;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* AI 레벨 선택 모달 */
.ai-levels {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.ai-level-btn {
    padding: 15px 10px;
    text-align: center;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: white;
    border: 2px solid #ecf0f1;
    color: #2c3e50;
    transition: all 0.3s ease;
}

.ai-level-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.ai-level-btn[data-level='초급']:hover {
    border-color: #27ae60;
    background: #eafaf1;
}

.ai-level-btn[data-level='중급']:hover {
    border-color: #f39c12;
    background: #fef9e7;
}

.ai-level-btn[data-level='고급']:hover {
    border-color: #e67e22;
    background: #fdf2e9;
}

.ai-level-btn[data-level='초고급']:hover {
    border-color: #e74c3c;
    background: #fdeaea;
}

.ai-level-btn small {
    font-size: 0.8rem;
    margin-top: 5px;
    opacity: 0.7;
}

/* 알림 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #2c3e50;
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    font-weight: 500;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 1001;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background: #27ae60;
}

.notification.error {
    background: #e74c3c;
}

.notification.warning {
    background: #f39c12;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    header h1 {
        font-size: 2rem;
    }

    .game-info {
        flex-direction: column;
        gap: 15px;
    }

    .player-info {
        flex-direction: column;
        gap: 15px;
    }

    #game-board {
        width: 100%;
        max-width: 400px;
        height: auto;
    }

    .users-grid {
        grid-template-columns: 1fr;
    }
}
