body {
    background: #000;
    color: white;
    font-family: 'Segoe UI', sans-serif;
    margin: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;

    touch-action: none; /* 브라우저 기본 터치 제스처(스크롤, 확대) 무시 */
    user-select: none; /* 텍스트 선택 방지 */
    -webkit-user-select: none;
    -webkit-touch-callout: none; /* 꾹 눌렀을 때 메뉴 뜨는 것 방지 */
    overscroll-behavior: none; /* 스크롤 바운스 방지 */
}

#game-container {
    position: relative;
    width: 360px;
    height: 600px;
    background: #050505;
    border: 4px solid #333;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 255, 204, 0.2);
    display: none;
    z-index: 100;
}

/* 곡 선택 화면 */
#song-selection {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #0a0a0a;
    z-index: 200;
}

.selection-title {
    color: #00ffcc;
    letter-spacing: 5px;
    margin-bottom: 30px;
}

.song-list {
    width: 420px;
    max-height: 400px;
    overflow-y: auto;
    background: #111;
    border-radius: 15px;
    border: 1px solid #333;
    padding: 15px;
}

.song-item {
    padding: 18px;
    margin-bottom: 8px;
    background: #1a1a1a;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: 0.2s;
}

.song-item:hover {
    border-color: #00ffcc;
    background: #222;
}

.selection-controls {
    margin-top: 30px;
    display: flex;
    gap: 15px;
}

/* 설정창 */
#option-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.98);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

.option-title {
    color: #00ffcc;
    margin-bottom: 30px;
}

.key-config-container {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
}

.key-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.key-label {
    font-size: 11px;
    color: #888;
    font-weight: bold;
    letter-spacing: 1px;
}

.key-box {
    width: 60px;
    height: 55px;
    background: #222;
    border: 2px solid #444;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #00ffcc;
    font-size: 22px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}

.key-box.waiting {
    border-color: #ffaa00;
    box-shadow: 0 0 15px #ffaa00;
    animation: blink 1s infinite;
}

.speed-control {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.speed-label {
    font-weight: bold;
    margin-bottom: 5px;
}

#speed-val {
    color: #00ffcc;
}

#speed-range {
    width: 250px;
    accent-color: #00ffcc;
}

/* 로딩 화면 */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 600;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #333;
    border-top: 4px solid #00ffcc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}



#score-display {
    position: absolute;
    top: 25px;
    right: 25px;
    font-size: 24px;
    color: #00ffcc;
    font-family: monospace;
    z-index: 20;
}

#combo-container {
    position: absolute;
    top: 120px;
    width: 100%;
    text-align: center;
    pointer-events: none;
    z-index: 20;
}

#combo-num {
    font-size: 60px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 15px #00ffcc;
    display: block;
}

#combo-text {
    font-size: 14px;
    letter-spacing: 5px;
    color: rgba(255, 255, 255, 0.6);
}

/* 오버레이 버튼 및 공통 */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 300;
    text-align: center;
}

.btn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 10px;
    border: none;
    background: #444; /* 기본값은 차분하게 */
    color: #fff;
    margin: 8px;
    width: 240px;
    transition: 0.2s;
    display: inline-block;
}

/* 가장 부각되어야 할 버튼: 기본 채보 플레이 */
#play-default-btn {
    background: #00ffcc;
    color: #000;
    padding: 18px 30px; /* 더 크게 */
    font-size: 18px;    /* 글씨도 더 크게 */
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.4);
}

.btn:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/* 커스텀 채보 로드: 보조 버튼 느낌 */
.btn-custom-load {
    background: #0055aa; /* 색상 통일 */
    color: #ddd;
    width: 100%;        /* HTML 인라인 스타일과 맞춤 */
    padding: 10px 20px;
    font-size: 14px;
    box-sizing: border-box;
    cursor: pointer;
    display: inline-block;
    line-height: normal;
    text-align: center;
}

.btn-custom-load:hover {
    background: #0077ee;
    color: #fff;
}

.btn-settings { background: #ffaa00; width: 160px; }
.btn-back { background: #444; color: white; width: 160px; }
.btn-exit { background: #ff4444; color: white; }
.btn-save { background: #ffaa00; width: 180px; margin-top: 40px; }
.btn-youtube { background: #ff0000; color: #fff; font-size: 14px; margin-bottom: 20px; }
.btn-cancel {
    background: transparent;
    color: #888;
    width: auto;
    font-size: 14px;
    text-decoration: underline;
}

#pause-song-title {
    color: #00ffcc;
    font-size: 18px;
    margin-bottom: 5px;
    opacity: 0.8;
}

.pause-title {
    color: #ffaa00;
    margin-top: 0;
}

.result-title {
    color: #00ffcc;
    margin-bottom: 10px;
}

#final-score {
    font-size: 40px;
    font-weight: bold;
    color: #fff;
}

.result-stats {
    width: 260px;
    margin: 20px 0;
    font-size: 16px;
    text-align: left;
}

.stat-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    border-bottom: 1px solid #333;
    padding-bottom: 2px;
}

.stat-label { color: #aaa; }
.stat-val { font-weight: bold; }

#progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 5px;
    background: #00ffcc;
    width: 0%;
    z-index: 30;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: 0.5; } }

@media screen and (max-width: 768px) {

    /* 1. Body의 Flex 중앙 정렬 해제 & 전체 크기 확보 */
    body {
        display: block; /* flex 제거 -> 위에서부터 채움 */
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        position: fixed; /* 스크롤 방지 및 화면 고정 */
        overflow: hidden;
    }

    /* 2. 게임 컨테이너를 Body 크기에 딱 맞춤 */
    #game-container {
        position: absolute; /* Body 기준으로 위치 잡기 */
        top: 0;
        left: 0;
        width: 100%;  /* Body 너비의 100% */
        height: 100%; /* Body 높이의 100% */
        
        /* 테두리 등 장식 제거 */
        border: none;
        border-radius: 0;
        box-shadow: none;
        margin: 0;
        background: #000; /* 배경색 확실하게 지정 */
    }

    /* 3. 곡 선택 화면 등 내부 요소 크기 조정 (화면 비율에 맞춤) */
    .song-list {
        width: 90%;
        max-height: 55%; /* 높이를 %로 주어 화면이 작아도 잘리지 않게 */
    }
    
    /* 4. 내부 UI 사이즈 최적화 */
    #combo-num { font-size: 15vh; } /* 화면 높이 비례 폰트 */
    #score-display { font-size: 20px; top: 10px; right: 10px; }
    
    /* 판정선 위치: 화면 하단 15% 지점 */
    #judgment-line { bottom: 15%; }
    
    /* 레인 힌트 문자 위치 */
    .lane .hint { bottom: 5%; font-size: 14px; opacity: 0.5; }
    
    /* 설정창 등 오버레이도 꽉 차게 */
    .overlay { width: 100%; height: 100%; }
    
    /* 버튼 크기 유동적 대응 */
    .btn { width: 70%; max-width: 300px; }
}

/* [추가] 모바일 일시정지 버튼 스타일 */
#mobile-pause-btn {
    position: absolute;
    top: 15px;
    left: 15px; /* 좌측 상단 배치 */
    z-index: 50; /* UI보다 위에, 오버레이보다 아래 */
    
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: 2px solid #fff;
    border-radius: 50%; /* 원형 버튼 */
    
    width: 45px;
    height: 45px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    
    display: flex; /* 모바일에서만 보이게 할 수도 있지만, PC에서도 편의상 둠 */
    align-items: center;
    justify-content: center;
    padding: 0;
    
    /* 터치 반응 속도 향상 */
    touch-action: manipulation;
}

#mobile-pause-btn:active {
    background: #00ffcc;
    color: #000;
    border-color: #00ffcc;
    transform: scale(0.95);
}


/* [추가] HOLD 텍스트 효과 (약간 떨림 or 네온 효과) */
.hold-text {
    color: #00ff00 !important; /* 밝은 초록색 */
    text-shadow: 0 0 10px #00ff00, 0 0 20px #00ff00;
    transform: scale(1.1);
}

/* [추가] 커스텀 채보 리스트 아이템 스타일 */
.custom-chart-item {
    padding: 12px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
}

.custom-chart-item:hover {
    background: #2a2a2a;
}

.custom-chart-info {
    display: flex;
    flex-direction: column;
}

.custom-chart-name {
    color: #00ffcc;
    font-weight: bold;
    font-size: 15px;
}

.custom-chart-creator {
    color: #888;
    font-size: 12px;
    margin-top: 3px;
}

.btn-play-custom {
    background: #0055aa;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}
.btn-play-custom:hover {
    background: #0077ee;
}