/* typingstyles.css */

/* 기본 리셋 및 폰트 설정 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: #f0f0f0;
    overflow: hidden; /* 단어가 화면 밖으로 나가는 것을 방지 */
}

/* 게임 컨테이너 */
#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* 시작 화면 스타일 */
#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #6B73FF 0%, #000DFF 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 1;
}

#start-screen.hidden {
    display: none;
}

#start-screen h1 {
    font-size: 48px;
    margin-bottom: 20px;
}

#start-screen p {
    font-size: 24px;
    margin-bottom: 30px;
}

#difficulty-buttons {
    display: flex;
    gap: 20px;
}

.difficulty-button {
    padding: 15px 30px;
    font-size: 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background-color: #ffffff;
    color: #000DFF;
    transition: background-color 0.3s, color 0.3s;
}

.difficulty-button:hover {
    background-color: #000DFF;
    color: white;
}

.difficulty-button.selected {
    background-color: #FF6B6B;
    color: white;
}

/* 기록보기 버튼 컨테이너 스타일 */
#view-records-container {
    margin-top: 20px; /* 난이도 버튼과의 간격 */
}

/* 기록보기 버튼 스타일 */
.view-records-button {
    padding: 12px 24px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background-color: #FFD700; /* 금색 배경 */
    color: #000;
    transition: background-color 0.3s, color 0.3s;
}

.view-records-button:hover {
    background-color: #FFA500; /* 주황색 배경으로 변경 */
    color: white;
}

/* 게임 화면 스타일 */
#game-screen {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end; /* 요소들을 아래쪽에 정렬 */
    padding: 20px;
}

/* 단어 컨테이너 스타일 */
#word-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* 단어를 클릭하지 못하도록 설정 */
    z-index: 0; /* 다른 요소들보다 뒤에 위치 */
}

/* 단어 스타일 */
.falling-word {
    position: absolute;
    top: -50px; /* 화면 위에서 시작 */
    font-size: 24px;
    font-weight: bold;
    color: #333;
    animation-name: fall;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

.falling-word.matched {
    color: #28a745; /* 맞춘 단어는 녹색으로 표시 */
    text-decoration: line-through;
}

/* 단어 떨어지는 애니메이션 */
@keyframes fall {
    from {
        top: -50px;
    }
    to {
        top: 100vh;
    }
}

/* 통계 및 입력창 컨테이너 */
#game-info {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px; /* 입력창과의 간격 */
}

/* 통계 표시 컨테이너 */
#stats-container {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 10px; /* 입력창과의 간격 */
    background: rgba(255, 255, 255, 0.8);
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#stats-container div {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

/* 생명 표시 컨테이너 */
#lives-board {
    display: flex;
    align-items: center;
    gap: 5px;
}

#lives-board img {
    width: 24px; /* 이미지 크기 조절 */
    height: 24px;
}

/* 입력창 컨테이너 */
#input-container {
    width: 100%;
}

#word-input {
    width: 100%;
    padding: 15px;
    font-size: 20px;
    border: 2px solid #333;
    border-radius: 8px;
    outline: none;
    text-align: center;
}

/* 팝업 스타일 */
.popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5); /* 반투명 배경 */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000; /* 다른 요소보다 위에 표시 */
}

.popup.hidden {
    display: none;
}

.popup-content {
    background: #fff;
    padding: 20px 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    max-height: 90vh;
    overflow-y: auto;
}

.popup-content h2 {
    margin-top: 0;
    font-size: 28px;
    color: #333;
}

.popup-content p {
    font-size: 18px;
    margin: 15px 0;
    color: #555;
}

.popup-content input {
    width: 80%;
    padding: 10px;
    margin: 10px 0;
    font-size: 16px;
    border: 2px solid #333;
    border-radius: 5px;
    outline: none;
}

.popup-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.popup-buttons button {
    padding: 10px 20px;
    font-size: 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background-color: #008CBA;
    color: white;
    transition: background-color 0.3s;
}

.popup-buttons button:hover {
    background-color: #005f6a;
}

/* 전체 기록 팝업 스타일 */
#records-popup .popup-content {
    max-height: 80vh;
    overflow-y: auto;
}

#records-popup h2 {
    margin-top: 0;
    font-size: 28px;
    color: #333;
}

/* 탭 네비게이션 스타일 */
.tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-button {
    padding: 10px 20px;
    font-size: 16px;
    border: none;
    border-bottom: 2px solid transparent;
    background-color: #f1f1f1;
    cursor: pointer;
    transition: border-bottom 0.3s, background-color 0.3s;
    border-radius: 5px 5px 0 0;
}

.tab-button.active {
    border-bottom: 2px solid #008CBA;
    background-color: #fff;
}

.tab-button:hover {
    background-color: #ddd;
}

/* 순위 테이블 스타일 */
.rank-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.rank-table th,
.rank-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
}

.rank-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

.rank-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.rank-table tr:hover {
    background-color: #ddd;
}

/* 순위 목록 헤더 */
#rankings h3,
#all-rankings h3 {
    margin-top: 20px;
    font-size: 22px;
    color: #333;
}

/* 모바일 및 반응형 스타일 */
@media (max-width: 768px) {
    /* 팝업 컨텐츠 패딩 조정 */
    .popup-content {
        padding: 15px 20px;
    }

    /* 입력창 폭 조정 */
    .popup-content input {
        width: 100%;
    }

    /* 버튼 레이아웃 변경 */
    .popup-buttons {
        flex-direction: column;
    }

    .popup-buttons button {
        width: 100%;
    }

    /* 순위 테이블 패딩 및 폰트 크기 조정 */
    .rank-table th,
    .rank-table td {
        padding: 6px;
        font-size: 14px;
    }

    /* 통계 표시 컨테이너 크기 조정 */
    #stats-container {
        padding: 8px 16px;
    }

    #stats-container div {
        font-size: 16px;
    }

    /* 단어 폰트 크기 조정 */
    .falling-word {
        font-size: 20px;
    }

    /* 입력창 폰트 크기 조정 */
    #word-input {
        font-size: 18px;
        padding: 12px;
    }

    /* 시작 화면 폰트 크기 조정 */
    #start-screen h1 {
        font-size: 36px;
    }

    #start-screen p {
        font-size: 20px;
    }

    .difficulty-button {
        padding: 12px 24px;
        font-size: 16px;
    }

    /* 기록보기 버튼 스타일 조정 (반응형) */
    .view-records-button {
        padding: 12px 24px;
        font-size: 16px;
    }

    /* 탭 버튼 스타일 조정 (반응형) */
    .tab-button {
        padding: 8px 16px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    /* 팝업 컨텐츠 패딩 조정 */
    .popup-content {
        padding: 10px 15px;
    }

    /* 팝업 헤더 폰트 크기 조정 */
    .popup-content h2,
    #records-popup h2 {
        font-size: 20px;
    }

    .popup-content p {
        font-size: 14px;
    }

    .popup-content input {
        font-size: 14px;
    }

    .popup-buttons button {
        font-size: 14px;
    }

    /* 순위 테이블 패딩 및 폰트 크기 조정 */
    .rank-table th,
    .rank-table td {
        padding: 4px;
        font-size: 12px;
    }

    /* 시작 화면 폰트 크기 조정 */
    #start-screen h1 {
        font-size: 28px;
    }

    #start-screen p {
        font-size: 16px;
    }

    .difficulty-button {
        padding: 10px 20px;
        font-size: 14px;
    }

    /* 단어 폰트 크기 조정 */
    .falling-word {
        font-size: 18px;
    }

    /* 입력창 폰트 크기 조정 */
    #word-input {
        font-size: 16px;
        padding: 10px;
    }

    /* 통계 표시 컨테이너 크기 조정 */
    #stats-container {
        padding: 6px 12px;
    }

    #stats-container div {
        font-size: 14px;
    }

    /* 탭 버튼 스타일 조정 (반응형) */
    .tab-button {
        padding: 6px 12px;
        font-size: 12px;
    }
}
