/* 
 * 샘물축구단 (Seamul-Soccer Showdown) V55.0 CSS (FINAL LAYOUT FIX)
 * Fixed: Top panel layout changed to row (horizontal) to prevent pushing down UI in Extreme mode
 */

/* 1. 기본 설정 */
:root { color-scheme: light only; }
body, html { 
    margin: 0; padding: 0; width: 100%; height: 100%; 
    overflow: hidden; background-color: #222; 
    font-family: 'Malgun Gothic', sans-serif; 
    touch-action: none; user-select: none; -webkit-user-select: none;
}
canvas { 
    display: block; background: #3cb371; 
    filter: none !important; -webkit-filter: none !important;
}

.hidden { display: none !important; }
.invisible { visibility: hidden !important; }

#intro-screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d); display: flex; flex-direction: column; align-items: center; justify-content: center; color: white; z-index: 200; }
.intro-sound-btn { position: absolute; top: 30px; right: 30px; background: rgba(255, 255, 255, 0.2); color: white; border: 2px solid white; padding: 10px 20px; border-radius: 30px; cursor: pointer; font-weight: bold; }
.logo-area { text-align: center; margin-bottom: 50px; }
.logo-area h1 { font-size: 60px; margin: 0; text-shadow: 0 5px 15px rgba(0,0,0,0.5); }
.logo-area h2 { font-size: 24px; margin: 10px 0; font-weight: normal; opacity: 0.8; }
.menu-area { text-align: center; display: flex; flex-direction: column; gap: 20px; width: 100%; align-items: center; }
.menu-guide { font-size: 18px; margin-bottom: 10px; opacity: 0.7; }
.mode-btn { width: 90%; max-width: 400px; padding: 20px; border: none; border-radius: 10px; margin: 0 auto; cursor: pointer; text-align: left; position: relative; overflow: hidden; }
.mode-btn.original { background: #fff; color: #333; border-left: 10px solid #333; }
.mode-btn.extreme { background: #222; color: #fff; border-left: 10px solid #f1c40f; }
.mode-title { display: block; font-size: 24px; font-weight: bold; margin-bottom: 5px; }
.mode-desc { display: block; font-size: 14px; opacity: 0.8; }
.copyright { position: absolute; bottom: 20px; font-size: 12px; opacity: 0.5; }

#game-container { position: relative; width: 100%; height: 100%; }
#ui-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }

.exit-btn { position: absolute; top: 20px; left: 20px; pointer-events: auto; background: rgba(0,0,0,0.5); color: #ddd; border: 1px solid #555; padding: 5px 10px; border-radius: 5px; cursor: pointer; z-index: 100; }
.sound-btn { position: absolute; top: 20px; right: 20px; background: rgba(0,0,0,0.6); color: white; border: 2px solid rgba(255,255,255,0.5); padding: 8px 15px; border-radius: 20px; cursor: pointer; font-weight: bold; pointer-events: auto; z-index: 100; }

/* *** [핵심 수정] 상단 패널 컨테이너 (가로 배치로 변경) *** */
.top-panel-container {
    position: absolute; top: 20px; left: 0; width: 100%; 
    display: flex; 
    flex-direction: row; /* 세로(column) -> 가로(row) 변경 */
    align-items: center; 
    justify-content: center; /* 중앙 정렬 */
    gap: 15px; /* 요소 간 간격 */
    pointer-events: none; 
    background: transparent !important;
    height: auto; 
    z-index: 10;
}

/* 바람 게이지 */
.wind-indicator { 
    background: rgba(0, 0, 0, 0.6); 
    border: 2px solid rgba(255,255,255,0.5); 
    border-radius: 50%; width: 70px; height: 70px; 
    display: flex; flex-direction: column; align-items: center; justify-content: center; 
    color: white; text-shadow: 1px 1px 2px black; flex-shrink: 0; 
    margin-bottom: 0; /* 마진 제거 */
}
.wind-label { font-size: 10px; color: #aaa; margin-bottom: 2px; }
#wind-arrow { font-size: 20px; font-weight: bold; transition: transform 0.5s; }
#wind-speed { font-size: 12px; font-weight: bold; color: #44ff44; }

/* 점수판 */
.scoreboard-panel { 
    background: rgba(0,0,0,0.85); padding: 12px 25px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.3); color: white; width: 380px; 
    /* 배지 위치 기준점 */
    position: relative;
}
.team-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 15px; font-weight: bold; }
.team-name { width: 70px; text-align: left; }
.markers { display: flex; gap: 5px; }
.marker { width: 14px; height: 14px; border-radius: 50%; background: #444; border: 1px solid #888; }
.marker.goal { background: #2ecc71; border-color: #fff; } .marker.miss { background: #e74c3c; border-color: #fff; }
.total-score { width: 30px; text-align: right; font-size: 18px; }
.round-indicator { margin-top: 5px; font-size: 11px; color: #aaa; text-align: center; letter-spacing: 2px; }

/* PC용 배지 (점수판 아래에 붙임) */
.turn-badge { 
    display: block; /* 블록 요소로 변경 */
    width: fit-content;
    margin: 5px auto 0 auto; /* 중앙 정렬 */
    padding: 8px 20px; border-radius: 5px; font-weight: 900; font-size: 20px; color: white; border: 2px solid white; text-shadow: 2px 2px 0 #000; background: #333; 
    
    /* PC에서는 점수판 바로 밑에 위치하도록 */
    position: absolute; 
    top: 100%; left: 50%; transform: translateX(-50%);
}
.turn-badge.attack { background: #e74c3c; } .turn-badge.defend { background: #3498db; }

#control-panel { position: absolute; bottom: 50px; left: 0; width: 100%; display: flex; flex-direction: column; align-items: center; transition: opacity 0.3s; pointer-events: none; }
#control-panel.hidden { opacity: 0; }
.action-guide { background: rgba(0,0,0,0.6); color: #fff; padding: 8px 25px; border-radius: 20px; font-size: 18px; font-weight: bold; margin-bottom: 15px; text-shadow: 1px 1px 2px black; border: 1px solid rgba(255,255,255,0.3); }

#power-container, #defense-timer-container { width: 400px; text-align: center; }
#power-container.hidden, #defense-timer-container.hidden { display: none; }
.power-label { color: #fff; font-size: 14px; margin-bottom: 5px; font-weight: 900; text-shadow: 0 0 4px #000; }
.power-bar-bg, .timer-bar-bg { width: 100%; height: 25px; background: #444; border: 3px solid #fff; border-radius: 15px; position: relative; overflow: hidden; }
.sweet-spot { position: absolute; left: 60%; width: 25%; height: 100%; background: #00ff00; opacity: 0.6; border-left: 2px solid #fff; border-right: 2px solid #fff; }
.critical-zone { position: absolute; left: 72%; width: 7%; height: 100%; background: #ffff00; opacity: 1.0; z-index: 5; border: 1px solid #000; }
.critical-zone.hidden { display: none; }
.danger-line { position: absolute; left: 85%; width: 3px; height: 100%; background: #ff0000; z-index: 6; }
#power-bar-fill { position: relative; width: 0%; height: 100%; background: #ffd700; border-right: 2px solid white; }
#defense-timer-fill { width: 0%; height: 100%; background: #3498db; transition: width 0.1s linear; }

.center-message { position: absolute; top: 20%; left: 50%; transform: translate(-50%, -50%); text-align: center; z-index: 30; width: 100%; }
.center-message.hidden { display: none; }
.center-message h1 { font-size: 80px; color: #ff4444; font-weight: 900; text-shadow: 2px 2px 0 #fff, -2px -2px 0 #fff; animation: popScale 0.2s ease-out; margin: 0; }
.center-message.critical h1 { color: #ffff00; text-shadow: 3px 3px 0 #ff0000; font-style: italic; font-size: 90px; }

.start-message { position: absolute; top: 45%; left: 50%; transform: translate(-50%, -50%); text-align: center; width: 100%; z-index: 10; pointer-events: auto; }
.start-message.hidden { display: none; }
.start-message h1 { font-size: 60px; margin: 0; color: #f1c40f; text-shadow: 3px 3px 0 #000; font-style: italic; }
.start-message p { font-size: 20px; color: white; margin-top: 15px; font-weight: bold; background: rgba(0,0,0,0.5); padding: 10px 20px; border-radius: 20px; }

.result-message { position: absolute; top: 35%; left: 50%; transform: translate(-50%, -50%); text-align: center; width: 100%; z-index: 20; }
.result-message.hidden { display: none; }
.result-message h1 { font-size: 70px; font-weight: 900; text-shadow: 3px 3px 0 #000; -webkit-text-stroke: 2px white; margin: 0; }

#result-modal, #exit-modal { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); display: flex; align-items: center; justify-content: center; pointer-events: auto; z-index: 100; }
#result-modal.hidden, #exit-modal.hidden { display: none; }
.modal-content { text-align: center; color: white; background: #333; padding: 40px 60px; border-radius: 15px; border: 2px solid #fff; }
.btn-group { display: flex; gap: 10px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.modal-content button { padding: 12px 20px; font-size: 16px; background: #2ecc71; color: white; border: none; border-radius: 5px; cursor: pointer; }

.mobile-controls { position: absolute; bottom: 40px; left: 0; width: 100%; height: 120px; display: flex; justify-content: space-between; align-items: center; padding: 0 30px; box-sizing: border-box; pointer-events: none; z-index: 50; }
.mobile-controls.hidden { display: none; }
.d-pad { display: flex; align-items: center; gap: 5px; pointer-events: auto; }
.d-pad-center-group { display: flex; align-items: center; justify-content: center; width: 50px; height: 105px; }
.d-pad-v { display: flex; flex-direction: column; gap: 5px; }
.ctrl-btn { width: 55px; height: 55px; background: rgba(255,255,255,0.15); border: 2px solid rgba(255,255,255,0.3); border-radius: 10px; color: white; font-size: 24px; touch-action: manipulation; display: flex; align-items: center; justify-content: center; transition: background 0.1s, transform 0.1s; }
.ctrl-btn:active, .ctrl-btn.pressed { background: rgba(241, 196, 15, 0.6) !important; border-color: #f1c40f !important; transform: scale(0.95); }
.action-circle { width: 90px; height: 90px; border-radius: 50%; background: rgba(231, 76, 60, 0.3); border: 3px solid rgba(231, 76, 60, 0.6); color: white; font-weight: bold; font-size: 18px; pointer-events: auto; touch-action: manipulation; transition: background 0.1s, transform 0.1s; display: flex; justify-content: center; align-items: center; text-align: center; }
.action-circle:active, .action-circle.pressed { background: rgba(231, 76, 60, 0.8) !important; transform: scale(0.95); }

.input-indicators { display: flex; gap: 15px; margin-top: 15px; align-items: center; justify-content: center; }
.input-indicators.hidden { display: none; }
.key-arrow, .key-center { width: 50px; height: 50px; border: 3px solid #777; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: bold; color: #777; background: rgba(0,0,0,0.5); transition: all 0.1s; }
.key-center { width: 70px; height: 40px; font-size: 14px; border-radius: 5px; }
.key-arrow.active, .key-center.active { background: #3498db; box-shadow: 0 0 15px #3498db; transform: scale(1.1); border-color: #fff; color: white; }

/* 모바일 레이아웃 최적화 */
@media (min-width: 769px) { .mobile-controls { display: none; } }
@media (max-width: 768px) { 
    .exit-btn, .sound-btn { top: 15px; padding: 8px 12px; }
    
    /* 상단 패널 가로 배치 및 위치 상향 */
    .top-panel-container { 
        top: 50px; /* 65px -> 50px (더 위로) */
        flex-direction: row; /* 가로 배치 유지 */
        gap: 5px; 
    }
    
    .scoreboard-panel { 
        padding: 8px 12px; width: auto; min-width: 200px; 
    }
    
    /* 모바일에서 WIND 게이지 크기 및 간격 조절 */
    .wind-indicator { 
        width: 55px; height: 55px; /* 조금 작게 */
        margin-bottom: 0;
    }
    .wind-arrow { font-size: 16px; }
    
    /* 배지 위치: 화면 하단으로 분리 (점수판 종속 X) */
    .turn-badge { 
        position: absolute; 
        bottom: 180px; left: 50%; transform: translateX(-50%); 
        top: auto; /* 상단 위치 무시 */
        padding: 3px 10px; font-size: 14px; z-index: 20; 
    }
    
    .power-label { font-size: 12px; margin-bottom: 4px; }
    .start-message h1 { font-size: 40px; margin-bottom: 10px; }
    .start-message p { font-size: 16px; }
    .center-message h1 { font-size: 40px; }
    .result-message h1 { font-size: 50px; }
    
    .input-indicators { display: none; }
    #control-panel { bottom: 150px; } 
    .action-guide { font-size: 16px; padding: 8px 25px; margin-bottom: 10px; }
}
