/* 암송 게임 스타일 */
.game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    z-index: 2000;
    display: none;
    overflow: hidden;
}

.game-container.active {
    display: block;
}

.game-header {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 2001;
    width: 90%;
    max-width: 600px;
}

.game-title {
    font-size: 24px;
    font-weight: 700;
    color: #e5e5e5;
    margin-bottom: 15px;
}

.game-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.game-timer,
.game-score,
.game-progress {
    font-size: 16px;
    font-weight: 600;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.game-timer {
    color: #60a5fa;
}

.game-score {
    color: #fbbf24;
}

.game-progress {
    color: #a0a0a0;
}

.btn-close-game {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(239, 68, 68, 0.2);
    border: 2px solid #ef4444;
    color: #ef4444;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    transition: all 0.3s ease;
    z-index: 2002;
}

.btn-close-game:hover {
    background: rgba(239, 68, 68, 0.4);
    transform: scale(1.1);
}

.game-area {
    position: absolute;
    top: 120px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    height: calc(100vh - 240px);
    background: rgba(15, 15, 15, 0.5);
    border: 2px solid #3a3a3a;
    border-radius: 20px;
    overflow: hidden;
}

.falling-word {
    position: absolute;
    padding: 14px 24px;
    background: transparent;
    color: white;
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    max-width: 90%;
}

.falling-word:hover {
    transform: scale(1.05);
}

/* 타겟 단어 강조 (노란색) */
.falling-word.target-word {
    color: #fbbf24;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.8),
                 0 2px 8px rgba(0, 0, 0, 0.8);
    animation: targetGlow 1.5s ease-in-out infinite;
}

@keyframes targetGlow {
    0%, 100% {
        text-shadow: 0 0 20px rgba(251, 191, 36, 0.8),
                     0 2px 8px rgba(0, 0, 0, 0.8);
    }
    50% {
        text-shadow: 0 0 30px rgba(251, 191, 36, 1),
                     0 0 40px rgba(251, 191, 36, 0.6),
                     0 2px 8px rgba(0, 0, 0, 0.8);
    }
}

/* 특별 아이템 스타일 */
.special-item {
    position: absolute;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateX(-50%);
    animation: itemGlow 1s ease-in-out infinite;
    z-index: 1001;
}

.special-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8));
}

@keyframes itemGlow {
    0%, 100% {
        filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8)) brightness(1);
        transform: translateX(-50%) scale(1);
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(255, 215, 0, 1)) brightness(1.2);
        transform: translateX(-50%) scale(1.1);
    }
}

/* 사탄 적 스타일 */
.satan-enemy {
    position: absolute;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateX(-50%);
    animation: satanPulse 0.5s ease-in-out infinite;
    z-index: 1002;
}

.satan-enemy img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 15px rgba(255, 0, 0, 0.9));
}

@keyframes satanPulse {
    0%, 100% {
        filter: drop-shadow(0 0 15px rgba(255, 0, 0, 0.9)) brightness(1);
        transform: translateX(-50%) scale(1);
    }
    50% {
        filter: drop-shadow(0 0 25px rgba(255, 0, 0, 1)) brightness(1.3);
        transform: translateX(-50%) scale(1.05);
    }
}

.basket {
    position: absolute;
    bottom: 20px;
    width: 156px;  /* 104px → 156px (50% 추가 증가) */
    height: 156px; /* 104px → 156px (50% 추가 증가) */
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 70px;
    transition: left 0.1s ease;
    transform-origin: center;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.basket:active {
    cursor: grabbing;
}

/* 캐릭터 이미지 스타일 */
.character-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    image-rendering: pixelated; /* 픽셀 아트 스타일 유지 */
    -webkit-image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.collected-words {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    background: rgba(26, 26, 26, 0.8);
    border: none;
    border-radius: 16px;
    padding: 15px;
    max-height: 100px;
    overflow-y: auto;
}

.collected-words-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.collected-word {
    padding: 6px 12px;
    background: transparent;
    color: #10b981;
    font-size: 16px;
    font-weight: 700;
    border-radius: 6px;
    border: 2px solid #10b981;
}

.game-controls {
    display: none;
}

.control-btn {
    display: none;
}

.game-instruction {
    display: none;
}
}

.game-complete {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0f0f0f;
    color: white;
    padding: 40px 20px;
    text-align: center;
    display: none;
    z-index: 10000;
    overflow-y: auto;
}

.game-complete.show {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 60px;
    animation: fadeIn 0.3s ease-out;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.05);
    }
    70% {
        transform: translate(-50%, -50%) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.game-complete h2 {
    display: none;
}

.game-complete p {
    font-size: 20px;
    margin-bottom: 20px;
    font-weight: 600;
}

.final-stats {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
}

.final-score,
.final-time {
    font-size: 18px;
    font-weight: 700;
    margin: 8px 0;
}

.final-score span,
.final-time span {
    font-size: 24px;
    color: #fbbf24;
}

.btn-restart {
    padding: 18px 48px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.btn-restart:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.5);
}

.btn-restart:active {
    transform: translateY(0);
}

/* 틀렸을 때 빨간 화면 오버레이 */
.wrong-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(239, 68, 68, 0.5);
    z-index: 2999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s ease;
}

.wrong-overlay.flash {
    animation: flashRed 0.5s ease-out;
}

@keyframes flashRed {
    0% {
        opacity: 0;
    }
    30% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* 게임 오버 화면 */
.game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
    display: none;
    z-index: 3000;
    max-width: 90%;
}

.game-over.show {
    display: block;
    animation: gameOverFadeIn 0.8s ease-out;
}

@keyframes gameOverFadeIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.game-over-image {
    max-width: 100%;
    height: auto;
    margin-bottom: 30px;
    border-radius: 12px;
}

/* 플레이어 이름 입력 모달 */
.player-name-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4000;
    animation: fadeIn 0.3s ease-in-out;
}

.player-name-modal.hidden {
    display: none;
}

.player-name-content {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
    text-align: center;
    max-width: 400px;
    width: 90%;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.player-name-content h2 {
    color: #fbbf24;
    font-size: 28px;
    margin-bottom: 10px;
    font-weight: 700;
}

.player-name-content p {
    color: #a0a0a0;
    margin-bottom: 30px;
    font-size: 16px;
}

/* 플레이어 선택 그리드 */
.player-selection-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.player-btn {
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.player-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #fbbf24;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
}

.player-btn:active {
    transform: translateY(0);
}

.player-btn.selected {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #1a1a1a;
    border-color: #fbbf24;
}

/* 모바일 반응형 */
@media (max-width: 480px) {
    .player-selection-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .player-btn {
        padding: 14px 18px;
        font-size: 14px;
    }
}

/* 랭킹 보드 스타일 */
.ranking-board {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    padding: 20px;
}

.ranking-title {
    color: #fbbf24;
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 30px;
    text-align: center;
}

.ranking-list {
    list-style: none;
    padding: 0;
    margin: 0 0 30px 0;
    width: 100%;
}

.ranking-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 25px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
}

.ranking-item:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateX(8px);
    border-color: rgba(251, 191, 36, 0.5);
}

.ranking-item.current-player {
    background: rgba(251, 191, 36, 0.25);
    border-color: #fbbf24;
    border-width: 3px;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
}

.ranking-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.ranking-position {
    font-size: 24px;
    font-weight: 700;
    min-width: 60px;
    color: #a0a0a0;
    text-align: center;
}

.ranking-item:nth-child(1) .ranking-position {
    color: #fbbf24;
    font-size: 32px;
}

.ranking-item:nth-child(2) .ranking-position {
    color: #c0c0c0;
    font-size: 28px;
}

.ranking-item:nth-child(3) .ranking-position {
    color: #cd7f32;
    font-size: 28px;
}

.ranking-player-name {
    color: white;
    font-size: 24px;
    font-weight: 600;
}

.ranking-score {
    color: #fbbf24;
    font-size: 28px;
    font-weight: 700;
}

.ranking-game-type {
    color: #888;
    font-size: 12px;
    margin-left: 8px;
}

.my-rank-badge {
    background: #fbbf24;
    color: #1a1a1a;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 15px;
    display: inline-block;
}

/* 모바일 반응형 */
@media (max-width: 480px) {
    .game-complete {
        padding: 20px 15px;
    }
    
    .game-complete.show {
        padding-top: 30px;
    }
    
    .ranking-board {
        padding: 10px;
        max-width: 100%;
    }
    
    .ranking-title {
        font-size: 28px;
        margin-bottom: 20px;
    }
    
    .ranking-item {
        padding: 14px 16px;
        margin-bottom: 8px;
    }
    
    .ranking-left {
        gap: 12px;
    }
    
    .ranking-position {
        font-size: 18px;
        min-width: 45px;
    }
    
    .ranking-item:nth-child(1) .ranking-position {
        font-size: 24px;
    }
    
    .ranking-item:nth-child(2) .ranking-position,
    .ranking-item:nth-child(3) .ranking-position {
        font-size: 22px;
    }
    
    .ranking-player-name {
        font-size: 17px;
    }
    
    .ranking-score {
        font-size: 20px;
    }
}

/* 태블릿 반응형 */
@media (max-width: 1024px) and (min-width: 481px) {
    /* 태블릿: 캐릭터 크기 20% 감소 (156px → 124.8px) */
    .basket {
        width: 124.8px; /* 156px의 80% */
        height: 124.8px;
    }
    
    /* 태블릿: 글자 크기 20% 감소 */
    .game-title {
        font-size: 19.2px; /* 24px의 80% */
    }
    
    .falling-word {
        font-size: 17.6px; /* 22px의 80% */
        padding: 11.2px 19.2px; /* 14px 24px의 80% */
    }
    
    .game-timer,
    .game-score,
    .game-progress {
        font-size: 12.8px; /* 16px의 80% */
        padding: 6.4px 12.8px; /* 8px 16px의 80% */
    }
    
    .game-instruction {
        font-size: 12.8px; /* 16px의 80% */
        padding: 8px 16px; /* 10px 20px의 80% */
    }
    
    /* 특별 아이템 크기도 감소 */
    .special-item {
        width: 64px; /* 80px의 80% */
        height: 64px;
    }
    
    .special-item .item-emoji {
        font-size: 40px; /* 50px의 80% */
    }
}

/* 모바일 반응형 */
@media (max-width: 480px) {
    .game-title {
        font-size: 20px;
    }
    
    .falling-word {
        font-size: 16px;
        padding: 10px 16px;
    }
    
    .basket {
        width: 70px;
        height: 70px;
        font-size: 60px;
    }
    
    .game-instruction {
        font-size: 16px;
        padding: 10px 20px;
    }
}
}
