/* [최종 수정] game.css - 모바일 닉네임 변경창 위치 재조정 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #2c3e50;
    height: 100vh;
    overflow: hidden;
    color: white;
}

.game-container {
    display: flex;
    height: 100vh;
}

.game-area {
    flex: 1;
    position: relative;
    background: #2c3e50;
    overflow: hidden;
}

.chat-area {
    width: 300px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    border-left: 2px solid rgba(255, 255, 255, 0.1);
    transition: height 0.3s ease-out;
}

.chat-header {
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    font-weight: bold;
}

.chat-messages {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.chat-message {
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    font-size: 14px;
    word-wrap: break-word;
    animation: fadeInMessage 0.3s ease-in;
}

.chat-message.system {
    background: rgba(52, 152, 219, 0.3);
    border-left: 3px solid #3498db;
    font-style: italic;
}

.chat-message .sender {
    font-weight: bold;
    color: #f39c12;
    margin-right: 5px;
}

.chat-message .device-icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-right: 4px;
    vertical-align: -0.1em;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.chat-message .device-icon.pc {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2h-4zM4 6h16v10H4V6z"/></svg>');
}

.chat-message .device-icon.mobile {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M17 1.01L7 1c-1.1 0-2 .9-2 2v18c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V3c0-1.1-.9-1.99-2-1.99zM17 19H7V5h10v14z"/></svg>');
}

.chat-message .timestamp {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    float: right;
}

.chat-input-area {
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    outline: none;
    font-size: 14px;
}

.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.game-canvas {
    background: transparent;
    cursor: pointer;
    position: relative;
    touch-action: none;
}

.ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 300px;
    bottom: 0;
    z-index: 100;
    pointer-events: none;
}

.status-panel,
.nickname-area,
.controls-help,
.mobile-controls,
.back-button {
    position: absolute;
    pointer-events: auto;
}

.status-panel,
.nickname-area,
.controls-help,
.back-button,
.hof-button {
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 15px;
    border-radius: 10px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 12px;
}


.status-panel { top: 20px; left: 20px; }
.connection-status { display: flex; align-items: center; margin-bottom: 10px; }
.status-dot { width: 12px; height: 12px; border-radius: 50%; margin-right: 8px; animation: pulse 2s infinite; }
.status-dot.connecting { background: #f39c12; }
.status-dot.connected { background: #27ae60; }
.status-dot.disconnected { background: #e74c3c; }
.player-info { font-size: 14px; line-height: 1.4; }
.player-count { margin-top: 5px; font-size: 12px; color: rgba(255, 255, 255, 0.8); }

.hof-button {
    display: block;
    margin-top: 10px;
    background: rgba(41, 128, 185, 0.8);
    color: white;
    text-decoration: none;
    text-align: center;
    padding: 8px;
    border-radius: 5px;
    transition: background-color 0.2s;
}
.hof-button:hover {
    background: rgba(52, 152, 219, 1);
}

.nickname-area { top: 20px; right: 20px; padding: 8px 12px; }
.nickname-input { background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.3); color: white; padding: 5px 10px; border-radius: 5px; font-size: 12px; width: 120px; }
.nickname-btn { background: #3498db; border: none; color: white; padding: 5px 10px; border-radius: 5px; font-size: 12px; margin-left: 5px; cursor: pointer; }
.nickname-btn:hover { background: #2980b9; }

.back-button {
    top: 70px;
    right: 20px;
    background: rgba(231, 76, 60, 0.8);
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}
.back-button:hover {
    background: rgba(231, 76, 60, 1);
}

.controls-help { bottom: 20px; left: 20px; font-size: 12px; line-height: 1.6; }
.mobile-controls { display: none; bottom: 30px; right: 20px; z-index: 200; background: transparent; border: none; backdrop-filter: none; }
.mobile-jump-btn { width: 80px; height: 80px; background: rgba(52, 152, 219, 0.8); border: 2px solid rgba(255, 255, 255, 0.3); border-radius: 50%; color: white; font-size: 24px; font-weight: bold; display: flex; align-items: center; justify-content: center; touch-action: none; }
.mobile-jump-btn:active { background: rgba(52, 152, 219, 1); transform: scale(0.95); }

.evolution-message {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translate(-50%, -20px);
    background: linear-gradient(45deg, #f39c12, #f1c40f);
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 999;
}

.evolution-message.active {
    opacity: 1;
    transform: translate(-50%, 0);
}

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes fadeInMessage { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 768px) {
    .game-container { flex-direction: column; }
    .game-area { height: 100%; position: absolute; top: 0; left: 0; width: 100%; }
    .ui-overlay { right: 0; bottom: 0; }
    .chat-area { width: 100%; height: 50px; border-left: none; border-top: 2px solid rgba(255, 255, 255, 0.1); flex-shrink: 0; overflow: hidden; position: absolute; bottom: 0; left: 0; z-index: 300; }
    .chat-area.expanded { height: 40vh; }
    .chat-header { cursor: pointer; }
    .chat-messages { height: calc(100% - 115px); max-height: none; }

    .status-panel { top: 10px; left: 10px; padding: 8px 12px; font-size: 12px; }
    .back-button { top: 10px; right: 10px; padding: 8px 12px; }
    
    .nickname-area {
        top: auto; /* 상단 고정 해제 */
        bottom: 70px; /* 채팅창 위, 점프 버튼 옆으로 이동 */
        left: 10px;
        right: auto; /* 오른쪽 고정 해제 */
        transform: none; /* 중앙 정렬 해제 */
        width: auto;
    }

    .controls-help { display: none; }
    .mobile-controls { display: flex; bottom: 70px; }
    .mobile-controls, .nickname-area, .back-button, .status-panel { transition: all 0.3s ease-in-out; }
    
    .game-container.chat-expanded .mobile-controls,
    .game-container.chat-expanded .status-panel,
    .game-container.chat-expanded .nickname-area,
    .game-container.chat-expanded .back-button {
        opacity: 0;
        pointer-events: none;
        transform: translateY(-20px);
    }
    
    .evolution-message { font-size: 16px; padding: 10px 20px; top: 50px; }
}

.overlay-chat-input-container { position: absolute; bottom: 0; left: 0; width: 100%; padding: 20px; display: flex; justify-content: center; pointer-events: none; opacity: 0; transform: translateY(20px); transition: all 0.2s ease-out; z-index: 101; }
.overlay-chat-input-container.active { opacity: 1; transform: translateY(0); pointer-events: auto; }
.overlay-chat-input { width: 60%; max-width: 800px; padding: 15px 20px; border: 2px solid rgba(255, 255, 255, 0.5); border-radius: 30px; background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(5px); color: white; font-size: 16px; text-align: center; outline: none; box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5); }
.overlay-chat-input::placeholder { color: rgba(255, 255, 255, 0.6); }

@media (min-width: 769px) {
    .game-container { flex-direction: row !important; }
    .chat-area { display: flex !important; width: 300px !important; height: 100vh !important; position: static !important; border-top: none !important; border-left: 2px solid rgba(255, 255, 255, 0.1) !important; }
    .chat-area.expanded { height: 100vh !important; }
    .ui-overlay { right: 300px !important; bottom: 0 !important; }
}