/* styles.css - 간소화된 모바일 친화적 스타일 */
:root {
    --screen-min: min(100vw, 100vh);
    --screen-max: max(100vw, 100vh);
    --track-width: calc(var(--screen-max) * 0.85);
    --track-height: calc(var(--screen-min) * 0.75);
    --track-border: calc(var(--screen-min) * 0.08);
    --vehicle-size: calc(var(--screen-min) * 0.12);
    --font-size: calc(var(--screen-min) * 0.025);
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    color: white;
    overflow-x: hidden;
    touch-action: manipulation;
}

.title {
    font-size: clamp(1.5rem, 2.5vw, 2.5rem);
    font-weight: bold;
    /* margin-bottom: 10px; */
    text-shadow: 0 0 7px rgba(255,255,255,0.5);
    text-align: center;
}

.setup-container {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(255,255,255,0.2);
    max-width: 600px;
    width: 100%;
}

.player-count-selector, .loser-rank-selector {
    margin-bottom: 15px;
    text-align: center;
}

.player-count-selector label, .loser-rank-selector label {
    display: block;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 8px;
}

.count-buttons, .rank-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.count-btn, .rank-btn {
    padding: 8px 12px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 10px;
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 40px;
    touch-action: manipulation;
}

.count-btn:hover, .rank-btn:hover {
    background: rgba(255,255,255,0.2);
}

.count-btn.active {
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    border-color: #feca57;
}

.rank-btn.active {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    border-color: #e74c3c;
}

/* === 새로 추가: 기타 선택 영역 === */
.custom-rank-selector {
    margin-top: 15px;
    padding: 15px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
}

.custom-rank-selector label {
    font-size: 14px;
    margin-bottom: 10px;
    display: block;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 10px;
    max-width: 400px;
    margin: 0 auto;
}

.rank-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
}

.rank-checkbox:hover {
    background: rgba(255,255,255,0.2);
}

.rank-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.rank-checkbox.checked {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
}
/* === 기타 선택 영역 끝 === */

.player-inputs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.player-input {
    position: relative;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.player-input.hidden {
    opacity: 0.3;
    pointer-events: none;
}

.player-input input {
    width: 100%;
    padding: 10px 35px 10px 10px;
    border: none;
    border-radius: 10px;
    background: rgba(255,255,255,0.9);
    font-size: 14px;
    color: #333;
    touch-action: manipulation;
}

.player-input input:focus {
    outline: none;
    box-shadow: 0 0 10px rgba(255,255,255,0.5);
}

.vehicle-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
}

.start-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    border: none;
    border-radius: 15px;
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 50px;
    touch-action: manipulation;
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.race-container {
    width: 100%;
    max-width: 100vw;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 15px;
    border: 1px solid rgba(255,255,255,0.2);
    display: none;
}

.race-info {
    margin-bottom: 15px;
    text-align: center;
}

.time-display {
    font-size: 20px;
    font-weight: bold;
}

.time-display #timeLeft {
    color: #feca57;
}

.progress-bar {
    width: 100%;
    height: 15px;
    background: rgba(255,255,255,0.3);
    border-radius: 10px;
    margin: 15px 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b, #feca57, #00b894, #74b9ff);
    width: 0%;
    transition: width 0.2s ease;
}

.race-track {
    width: var(--track-width);
    height: var(--track-height);
    max-width: 100%;
    max-height: 70vh;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    border-radius: 15px;
    position: relative;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    overflow: visible;
}

.track-border {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: var(--track-border) solid #7f8c8d;
    border-radius: 15px;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.3);
}

.track-inner {
    position: absolute;
    top: var(--track-border);
    left: var(--track-border);
    right: var(--track-border);
    bottom: var(--track-border);
    background: linear-gradient(135deg, #27ae60, #2ecc71, #00b894);
    border-radius: 10px;
}

.start-line {
    position: absolute;
    top: var(--track-border);
    left: 20%;
    width: 4px;
    height: calc(100% - var(--track-border) * 2);
    background: linear-gradient(180deg, #e74c3c, #c0392b);
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.8);
}

/* === 2열 순위표 스타일 (데모 기반) === */
.center-rankings {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    max-width: 100%;
    max-height: 100%;
    overflow-y: auto;
    border: 2px solid rgba(255,255,255,0.2);
}

.center-rankings h3 {
    color: #feca57;
    font-size: 23px;
    margin-bottom: 15px;
    text-align: center;
    text-shadow: 0 0 10px rgba(254, 202, 87, 0.5);
}

/* 2열 그리드 레이아웃 */
#centerRankingList {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 15px;
    width: 100%;
}

.ranking-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    font-size: 13px;
    gap: 8px;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    transition: all 0.2s ease;
    border: 1px solid rgba(255,255,255,0.1);
    min-height: 66px;
}

.ranking-item:hover {
    background: rgba(255,255,255,0.1);
    transform: translateY(-1px);
}

.rank-number {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Lottie 아이콘 스타일 */
.rank-lottie-icon {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
}

.rank-lottie-icon svg {
    width: 100% !important;
    height: 100% !important;
}

/* 순위별 색상 */
.rank-1 { 
    background: linear-gradient(45deg, #FFD700, #FFA500); 
    color: #000; 
    box-shadow: 0 2px 10px rgba(255, 215, 0, 0.4);
}
.rank-2 { 
    background: linear-gradient(45deg, #C0C0C0, #A0A0A0); 
    color: #000; 
    box-shadow: 0 2px 8px rgba(192, 192, 192, 0.4);
}
.rank-3 { 
    background: linear-gradient(45deg, #CD7F32, #B8860B); 
    color: #fff; 
    box-shadow: 0 2px 8px rgba(205, 127, 50, 0.4);
}
.rank-4 { 
    background: linear-gradient(45deg, #4CAF50, #45a049); 
    color: #fff; 
}
.rank-5, .rank-6, .rank-7, .rank-8 { 
    background: linear-gradient(45deg, #6c5ce7, #a29bfe); 
    color: #fff; 
}

/* 방향별 상태 효과 스타일 */
.vehicle.stunned {
    filter: brightness(0.6) drop-shadow(0 0 10px red);
}

/* 상단 트랙 스턴 */
.vehicle.stunned:not([style*="rotate"]):not([style*="scaleX(-1)"]) {
    animation: dizzy-top 0.5s ease-in-out infinite;
}

/* 우측 트랙 스턴 */
.vehicle.stunned[style*="rotate(90deg)"] {
    animation: dizzy-right 0.5s ease-in-out infinite;
}

/* 하단 트랙 스턴 */
.vehicle.stunned[style*="scaleX(-1)"] {
    animation: dizzy-bottom 0.5s ease-in-out infinite;
}

/* 좌측 트랙 스턴 */
.vehicle.stunned[style*="rotate(-90deg)"] {
    animation: dizzy-left 0.5s ease-in-out infinite;
}

.vehicle.boosted {
    filter: brightness(1.5) drop-shadow(0 0 15px gold);
}

/* 상단 트랙 부스터 */
.vehicle.boosted:not([style*="rotate"]):not([style*="scaleX(-1)"]) {
    animation: boost-top 0.4s ease-in-out infinite;
}

/* 우측 트랙 부스터 */
.vehicle.boosted[style*="rotate(90deg)"] {
    animation: boost-right 0.4s ease-in-out infinite;
}

/* 하단 트랙 부스터 */
.vehicle.boosted[style*="scaleX(-1)"] {
    animation: boost-bottom 0.4s ease-in-out infinite;
}

/* 좌측 트랙 부스터 */
.vehicle.boosted[style*="rotate(-90deg)"] {
    animation: boost-left 0.4s ease-in-out infinite;
}

.vehicle.reversed {
    filter: hue-rotate(180deg) drop-shadow(0 0 8px purple);
}

/* 상단 트랙 역주행 */
.vehicle.reversed:not([style*="rotate"]):not([style*="scaleX(-1)"]) {
    animation: reverse-top 0.4s ease-in-out infinite;
}

/* 우측 트랙 역주행 */
.vehicle.reversed[style*="rotate(90deg)"] {
    animation: reverse-right 0.4s ease-in-out infinite;
}

/* 하단 트랙 역주행 */
.vehicle.reversed[style*="scaleX(-1)"] {
    animation: reverse-bottom 0.4s ease-in-out infinite;
}

/* 좌측 트랙 역주행 */
.vehicle.reversed[style*="rotate(-90deg)"] {
    animation: reverse-left 0.4s ease-in-out infinite;
}

/* 방향별 애니메이션 정의 */

/* 스턴 애니메이션 */
@keyframes dizzy-top {
    0%, 100% { transform: scaleX(1) rotate(-5deg); }
    50% { transform: scaleX(1) rotate(5deg); }
}

@keyframes dizzy-right {
    0%, 100% { transform: rotate(90deg) rotate(-5deg); }
    50% { transform: rotate(90deg) rotate(5deg); }
}

@keyframes dizzy-bottom {
    0%, 100% { transform: scaleX(-1) rotate(-5deg); }
    50% { transform: scaleX(-1) rotate(5deg); }
}

@keyframes dizzy-left {
    0%, 100% { transform: rotate(-90deg) rotate(-5deg); }
    50% { transform: rotate(-90deg) rotate(5deg); }
}

/* 부스터 애니메이션 */
@keyframes boost-top {
    0% { transform: scaleX(1) scale(1); }
    50% { transform: scaleX(1) scale(1.15); }
    100% { transform: scaleX(1) scale(1); }
}

@keyframes boost-right {
    0% { transform: rotate(90deg) scale(1); }
    50% { transform: rotate(90deg) scale(1.15); }
    100% { transform: rotate(90deg) scale(1); }
}

@keyframes boost-bottom {
    0% { transform: scaleX(-1) scale(1); }
    50% { transform: scaleX(-1) scale(1.15); }
    100% { transform: scaleX(-1) scale(1); }
}

@keyframes boost-left {
    0% { transform: rotate(-90deg) scale(1); }
    50% { transform: rotate(-90deg) scale(1.15); }
    100% { transform: rotate(-90deg) scale(1); }
}

/* 역주행 애니메이션 */
@keyframes reverse-top {
    0%, 100% { transform: scaleX(1) translateX(0); }
    25% { transform: scaleX(1) translateX(-3px); }
    75% { transform: scaleX(1) translateX(3px); }
}

@keyframes reverse-right {
    0%, 100% { transform: rotate(90deg) translateX(0); }
    25% { transform: rotate(90deg) translateX(-3px); }
    75% { transform: rotate(90deg) translateX(3px); }
}

@keyframes reverse-bottom {
    0%, 100% { transform: scaleX(-1) translateX(0); }
    25% { transform: scaleX(-1) translateX(-3px); }
    75% { transform: scaleX(-1) translateX(3px); }
}

@keyframes reverse-left {
    0%, 100% { transform: rotate(-90deg) translateX(0); }
    25% { transform: rotate(-90deg) translateX(-3px); }
    75% { transform: rotate(-90deg) translateX(3px); }
}

.lottie-container {
    position: absolute;
    z-index: 100;
    transition: all 0.1s linear;
    transform-origin: center;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.lottie-container svg {
    width: 100% !important;
    height: 100% !important;
}

.lottie-preview {
    width: 25px;
    height: 25px;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.lottie-preview svg {
    width: 100% !important;
    height: 100% !important;
}

.vehicle {
    position: absolute;
    font-size: var(--vehicle-size);
    z-index: 100;
    transition: all 0.1s linear;
    transform-origin: center;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.vehicle.moving {
    /* Lottie 애니메이션이 자체적으로 움직임을 처리하므로 bounce 제거 */
}

.vehicle.stunned {
    animation: dizzy 0.5s ease-in-out infinite;
    filter: brightness(0.6) drop-shadow(0 0 10px red);
}

.vehicle.boosted {
    animation: boost 0.4s ease-in-out infinite;
    filter: brightness(1.5) drop-shadow(0 0 15px gold);
}

.vehicle.reversed {
    animation: reverse 0.4s ease-in-out infinite;
    filter: hue-rotate(180deg) drop-shadow(0 0 8px purple);
}

.vehicle.finished {
    animation: fadeOut 0.5s ease-out forwards;
}

@keyframes bounce {
    0% { transform: translateY(0px) scale(1); }
    100% { transform: translateY(-4px) scale(1.05); }
}

.player-name {
    position: absolute;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 2px 5px;
    border-radius: 5px;
    font-weight: bold;
    font-size: calc(var(--font-size) * 0.6);
    white-space: nowrap;
    transform: translate(+10%, 0);
    pointer-events: none;
    z-index: 99;
}

.player-name.finished {
    animation: fadeOut 0.5s ease-out forwards;
}

/* 디버깅용 경로 선 */
.debug-path {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

.debug-line {
    opacity: 0.8;
}

/* 파티클 효과 */
@keyframes particle-float {
    0% { 
        transform: translateY(0) scale(1); 
        opacity: 1; 
    }
    100% { 
        transform: translateY(-40px) scale(1.3); 
        opacity: 0; 
    }
}

/* 이벤트 알림 강화 */
.event-notification {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(45deg, #ff4757, #ff3838);
    color: white;
    padding: 15px 25px;
    border-radius: 15px;
    font-weight: bold;
    z-index: 1000;
    display: none;
    text-align: center;
    max-width: 300px;
    animation: eventPop 0.5s ease-out;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    border: 2px solid rgba(255,255,255,0.3);
}

@keyframes eventPop {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.countdown {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(60px, 15vw, 120px);
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 30px rgba(255,255,255,0.8);
    z-index: 2000;
    display: none;
}

.countdown.show {
    display: block;
    animation: countdownPulse 1s ease-in-out;
}

@keyframes countdownPulse {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.result-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.result-popup {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.result-icon {
    font-size: 60px;
    margin: 15px 0;
}

.result-title {
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 20px;
}

/* === 새로 추가: 단일 당첨자 스타일 === */
.single-winner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 30px 0;
    text-align: center;
}

.result-character {
    width: 80px;
    height: 80px;
    margin: 0 auto 15px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
}

.result-name {
    font-size: 28px;
    font-weight: bold;
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.result-subtitle {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 20px;
}

/* === 새로 추가: 복수 당첨자 스타일 === */
.multiple-winners {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 30px 0;
    text-align: center;
}

.winners-grid {
    justify-content: center; /* 핵심: 가운데 정렬 */
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 항상 3열 유지 */
    gap: 15px;
    margin: 20px 0;
    max-width: 400px;
    max-height: 300px;
    overflow-y: auto;
    justify-items: center; /* 그리드 아이템 중앙 정렬 */
}

.winner-item {
    text-align: center;
    background: rgba(255,255,255,0.1);
    border-radius: 15px;
    padding: 15px 10px;
    border: 1px solid rgba(255,255,255,0.2);
    width: 100%; /* 그리드 셀에 맞춤 */
    max-width: 120px; /* 최대 너비 제한 */
}

.winner-character {
    width: 50px;
    height: 50px;
    margin: 0 auto 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 25px;
}

.winner-name {
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.winner-rank {
    font-size: 12px;
    color: #feca57;
    opacity: 0.9;
}
/* === 복수 당첨자 스타일 끝 === */

.result-btn {
    padding: 12px 25px;
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 44px;
    touch-action: manipulation;
}

.result-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

/* 모바일 최적화 */
@media (max-width: 768px) {
    :root {
        --track-width: calc(var(--screen-min) * 0.95);
        --track-height: calc(var(--screen-max) * 0.6);
        --vehicle-size: calc(var(--screen-min) * 0.16);  /* 모바일에서 더 크게 */
        --track-border: calc(var(--screen-min) * 0.16); 
    }
    
    body {
        padding: 5px;
    }
    
    .setup-container {
        padding: 15px;
    }
    
    .race-container {
        padding: 10px;
    }
    
    .player-inputs-grid {
        gap: 8px;
    }
    
    /* === 모바일 순위표 최적화 === */
    .center-rankings {
        max-width: 90%;
        padding: 5px;
    }
    
    .center-rankings h3 {
        font-size: 15px;
        margin-bottom: 11px;
    }

    .player-name {
    font-size: 8px;
    }

    /* 모바일에서는 1열로 */
    #centerRankingList {
        grid-template-columns: 1fr;
        gap: 5px;
    }
    
    .ranking-item {
        font-size: 10px;
        gap: 6px;
        padding: 5px 6px;
        min-height: 35px;
    }
    
    .rank-number {
        width: 18px;
        height: 18px;
        font-size: 6px;
    }
    
    .rank-lottie-icon {
        width: 16px !important;
        height: 16px !important;
    }
    /* === 모바일 순위표 끝 === */
    
    .result-popup {
        padding: 20px;
        max-width: 400px;
    }
    
    .result-icon {
        font-size: 50px;
    }
    
    .result-title {
        font-size: 20px;
    }
    
    .result-name {
        font-size: 22px;
    }
    
    .result-subtitle {
        font-size: 14px;
    }
    
    /* === 새로 추가: 모바일에서 복수 당첨자 2열 === */
    .winners-grid {
        grid-template-columns: repeat(3, 1fr); /* 여전히 3열 */
        gap: 8px; /* 간격만 줄임 */
        max-width: 300px;
        max-height: 250px;
    }
    
    .winner-item {
        padding: 10px 5px; /* 패딩만 줄임 */
        max-width: 90px;
    }
    
    .winner-character {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
    
    .winner-name {
        font-size: 12px;
    }
    
    .winner-rank {
        font-size: 10px;
    }
    
    .checkbox-grid {
        grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
        gap: 8px;
    }
    
    .rank-checkbox {
        font-size: 11px;
        padding: 6px;
    }
    /* === 모바일 복수 당첨자 끝 === */
}

/* 작은 모바일 화면 */
@media (max-width: 380px) {
    .count-buttons, .rank-buttons {
        gap: 5px;
    }
    
    .count-btn, .rank-btn {
        padding: 6px 8px;
        font-size: 11px;
        min-height: 35px;
    }
    
    /* === 작은 모바일 순위표 === */
    .center-rankings {
        max-width: 95%;
        padding: 12px;
    }
    
    .center-rankings h3 {
        font-size: 14px;
        margin-bottom: 10px;
    }
    
    .ranking-item {
        font-size: 11px;
        gap: 5px;
        padding: 4px 5px;
        min-height: 30px;
    }
    
    .rank-number {
        width: 16px;
        height: 16px;
        font-size: 8px;
    }
    
    .rank-lottie-icon {
        width: 14px !important;
        height: 14px !important;
    }
    /* === 작은 모바일 순위표 끝 === */
    
    /* === 새로 추가: 작은 모바일에서 복수 당첨자 1열 === */
    .winners-grid {
        gap: 5px;
        max-width: 280px;
    }
    
    .winner-item {
        padding: 8px 4px;
        max-width: 80px;
    }
    
    .winner-character {
        width: 30px;
        height: 30px;
        font-size: 16px;
    }
    
    .winner-name {
        font-size: 10px;
    }
    
    .winner-rank {
        font-size: 8px;
    }

    .checkbox-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    /* === 작은 모바일 복수 당첨자 끝 === */
}



/* 게임 도움말 버튼들 (2열 배치) */
.game-help-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.help-btn {
    padding: 12px 20px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 15px;
    color: white;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-btn:hover {
    background: rgba(255,255,255,0.25);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.help-btn:active {
    transform: translateY(0);
}

/* 게임 도움말 버튼들 (2열 배치) */
.game-help-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.help-btn {
    padding: 12px 20px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 15px;
    color: white;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-btn:hover {
    background: rgba(255,255,255,0.25);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.help-btn:active {
    transform: translateY(0);
}

/* 게임 정보 텍스트 */
.game-info-text {
    margin-top: 15px;
    text-align: center;
    font-size: 12px;
    line-height: 1.4;
    color: rgba(255,255,255,0.8);
}

.game-info-text p {
    margin: 3px 0;
}

.game-info-text a {
    color: #feca57;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.3s ease;
}

.game-info-text a:hover {
    color: #ff6b6b;
    text-decoration: underline;
}

/* 등수 선택 그리드 */
.rank-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin: 20px 0;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.rank-selection-item {
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 15px;
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    font-weight: bold;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rank-selection-item:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

.rank-selection-item.selected {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    border-color: #e74c3c;
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

/* 모달 액션 버튼들 */
.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.modal-btn {
    padding: 10px 25px;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
}

.cancel-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}

.cancel-btn:hover {
    background: rgba(255,255,255,0.3);
}

.confirm-btn {
    background: linear-gradient(45deg, #00b894, #00a085);
    color: white;
}

.confirm-btn:hover {
    background: linear-gradient(45deg, #00a085, #008f76);
    transform: translateY(-2px);
}

/* 모달 스타일 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    border: 2px solid rgba(255,255,255,0.2);
    position: relative;
    margin: auto;
    transform: none;
}

.modal-header {
    padding: 20px 25px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: white;
    font-size: 22px;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.modal-close:hover {
    background: rgba(255,255,255,0.2);
}

.modal-body {
    padding: 20px 25px;
    max-height: calc(80vh - 100px);
    overflow-y: auto;
    color: white;
}

/* 규칙 섹션 */
.rule-section, .info-section, .contact-section {
    margin-bottom: 25px;
}

.rule-section h3, .info-section h3, .contact-section h3 {
    color: #feca57;
    font-size: 18px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rule-section p, .info-section p, .contact-section p {
    margin-bottom: 10px;
    line-height: 1.6;
    opacity: 0.9;
}

.rule-section ul, .info-section ul, .contact-section ul {
    padding-left: 20px;
    margin-bottom: 10px;
}

.rule-section li, .info-section li, .contact-section li {
    margin-bottom: 8px;
    line-height: 1.5;
    opacity: 0.9;
}

/* 스킬 그리드 */
.skill-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.skill-item {
    background: rgba(255,255,255,0.1);
    border-radius: 15px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(255,255,255,0.2);
    transition: transform 0.3s ease;
}

.skill-item:hover {
    transform: translateY(-2px);
    background: rgba(255,255,255,0.15);
}

.skill-icon {
    font-size: 28px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    flex-shrink: 0;
}

.skill-info h4 {
    margin: 0 0 5px 0;
    color: #feca57;
    font-size: 16px;
}

.skill-info p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.4;
}

/* 연락처 정보 삭제됨 */

/* 모바일 최적화 */
@media (max-width: 768px) {
    .game-help-buttons {
        gap: 8px;
        margin-bottom: 15px;
    }
    
    .help-btn {
        padding: 10px 15px;
        font-size: 12px;
        min-height: 45px;
    }
    
    .game-info-text {
        font-size: 11px;
        margin-top: 12px;
    }
    
    .rank-selection-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        margin: 15px 0;
    }
    
    .rank-selection-item {
        padding: 12px 8px;
        font-size: 12px;
        min-height: 50px;
    }
    
    .modal-btn {
        padding: 8px 20px;
        font-size: 14px;
    }
    
    .modal-content {
        margin: 10px;
        max-height: 90vh;
    }
    
    .modal-header {
        padding: 15px 20px 10px;
    }
    
    .modal-header h2 {
        font-size: 18px;
    }
    
    .modal-body {
        padding: 15px 20px;
        max-height: calc(90vh - 80px);
    }
    
    .skill-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .skill-item {
        padding: 12px;
        gap: 10px;
    }
    
    .skill-icon {
        font-size: 24px;
        width: 40px;
        height: 40px;
    }
    
    .skill-info h4 {
        font-size: 14px;
    }
    
    .skill-info p {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .help-btn {
        padding: 8px 12px;
        font-size: 11px;
        min-height: 40px;
    }
    
    .game-info-text {
        font-size: 10px;
    }
    
    .rank-selection-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .rank-selection-item {
        padding: 10px 6px;
        font-size: 11px;
        min-height: 45px;
    }
}

/* 게임규칙 트렌디한 스타일 */
.rules-container {
    max-width: 100%;
}

/* 히어로 섹션 */
.rule-hero {
    background: linear-gradient(135deg, rgba(255,107,107,0.2), rgba(254,202,87,0.2));
    border-radius: 20px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    border: 1px solid rgba(255,255,255,0.3);
}

.rule-hero-icon {
    font-size: 48px;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    flex-shrink: 0;
}

.rule-hero-content h3 {
    margin: 0 0 8px 0;
    color: #feca57;
    font-size: 24px;
    font-weight: bold;
}

.rule-hero-content p {
    margin: 0;
    font-size: 16px;
    color: rgba(255,255,255,0.9);
    line-height: 1.5;
}

/* 섹션 스타일 */
.rule-section {
    margin-bottom: 25px;
}

.rule-section h4 {
    color: #feca57;
    font-size: 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 진행 단계 스타일 */
.rule-steps {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.rule-step {
    background: rgba(255,255,255,0.08);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.rule-step:hover {
    background: rgba(255,255,255,0.12);
    transform: translateX(5px);
}

.rule-step::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(45deg, #ff6b6b, #feca57);
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(45deg, #fd79a8, #fdcb6e);
    color: white;
    font-weight: bold;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(253,121,168,0.3);
}

.step-content h5 {
    margin: 0 0 5px 0;
    color: white;
    font-size: 16px;
    font-weight: bold;
}

.step-content p {
    margin: 0;
    color: rgba(255,255,255,0.8);
    font-size: 14px;
    line-height: 1.4;
}

/* 특징 카드 스타일 */
.rule-features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.feature-card {
    background: rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.3s ease;
}

.feature-card:hover {
    background: rgba(255,255,255,0.12);
    transform: translateY(-2px);
}

.feature-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    flex-shrink: 0;
}

.feature-text strong {
    display: block;
    color: white;
    font-size: 14px;
    margin-bottom: 2px;
}

.feature-text small {
    color: rgba(255,255,255,0.7);
    font-size: 12px;
}

/* 모바일 최적화 */
@media (max-width: 768px) {
    .rule-hero {
        flex-direction: column;
        text-align: center;
        padding: 20px;
        gap: 15px;
    }
    
    .rule-hero-icon {
        font-size: 40px;
        width: 60px;
        height: 60px;
    }
    
    .rule-hero-content h3 {
        font-size: 20px;
    }
    
    .rule-hero-content p {
        font-size: 14px;
    }
    
    .rule-section h4 {
        font-size: 18px;
    }
    
    .rule-step {
        flex-direction: column;
        text-align: center;
        gap: 15px;
        padding: 16px;
    }
    
    .rule-step:hover {
        transform: translateY(-2px);
    }
    
    .step-number {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    .step-content h5 {
        font-size: 15px;
    }
    
    .step-content p {
        font-size: 13px;
    }
    
    .rule-features {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .feature-card {
        padding: 14px;
        gap: 10px;
    }
    
    .feature-icon {
        font-size: 20px;
        width: 35px;
        height: 35px;
    }
    
    .feature-text strong {
        font-size: 13px;
    }
    
    .feature-text small {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .rule-hero {
        padding: 15px;
    }
    
    .rule-step {
        padding: 12px;
    }
    
    .step-number {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
    
    .feature-card {
        padding: 12px;
    }
}

/* 모바일 PC 권장 배너 스타일 */
.mobile-pc-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #fd79a8, #fdcb6e);
    color: white;
    z-index: 9999;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transform: translateY(-100%);
    transition: transform 0.5s ease;
    display: none; /* 기본적으로 숨김 */
}

.mobile-pc-banner.show {
    transform: translateY(0);
}

.banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    max-width: 100%;
}

.banner-text {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.banner-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.banner-message {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.banner-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin-left: 10px;
}

.banner-close:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.banner-close span {
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
}

/* 배너가 표시될 때 body에 padding-top 추가 */
body.banner-visible {
    padding-top: 52px; /* 배너 높이만큼 */
}

/* 모바일에서만 표시 */
@media (min-width: 769px) {
    .mobile-pc-banner {
        display: none !important;
    }
}

/* 작은 모바일 화면 최적화 */
@media (max-width: 380px) {
    .banner-message {
        font-size: 14px;
        font-weight: 500;
        line-height: 1.3;
        text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    }
    
    .banner-icon {
        font-size: 16px;
    }
    
    .banner-close {
        width: 26px;
        height: 26px;
    }
    
    .banner-close span {
        font-size: 14px;
    }
    
    body.banner-visible {
        padding-top: 48px;
    }
}

/* Lottie 호버 미리보기 효과 */
.lottie-preview {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    border-radius: 50%;
}

.player-input:hover .lottie-preview {
    transform: translateY(-50%) scale(2.5);
    width: 50px !important;
    height: 50px !important;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 100;
}

.player-input:hover .lottie-preview svg {
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.4));
}

/* 펄스 효과 */
@keyframes lottie-pulse {
    0% { box-shadow: 0 10px 30px rgba(0,0,0,0.3), 0 0 0 0 rgba(255,255,255,0.4); }
    70% { box-shadow: 0 10px 30px rgba(0,0,0,0.3), 0 0 0 10px rgba(255,255,255,0); }
    100% { box-shadow: 0 10px 30px rgba(0,0,0,0.3), 0 0 0 0 rgba(255,255,255,0); }
}

.player-input:hover .lottie-preview {
    animation: lottie-pulse 1.5s infinite;
}

/* 모바일 최적화 */
@media (max-width: 768px) {
    .player-input:hover .lottie-preview {
        transform: translateY(-50%) scale(2);
        width: 40px !important;
        height: 40px !important;
    }
}

/* 하단 고정 저작권 */
.footer-copyright {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    color: rgba(255,255,255,0.8);
    text-align: center;
    padding: 8px 15px;
    font-size: 11px;
    line-height: 1.3;
    z-index: 1000;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.footer-copyright a {
    color: #feca57;
    text-decoration: none;
    font-weight: bold;
    font-size: 11px;
}

.footer-copyright a:hover {
    color: #ff6b6b;
    text-decoration: underline;
}

.footer-copyright span {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    opacity: 0.7;
}

/* 본문에 하단 여백 추가 */
body {
    /*padding-bottom: 60px;*/ /* 저작권 영역만큼 여백 */
}

@media (max-width: 768px) {
    .footer-copyright {
        font-size: 9px;
        padding: 6px 10px;
    }
    
    .footer-copyright span {
        font-size: 10px;
    }
    
    body {
        padding-bottom: 50px;
    }
}

/* 카드뉴스 스타일 */
.result-carousel {
    position: relative;
    overflow: hidden;
    border-radius: 15px;
    margin-bottom: 20px;
}

.result-page {
    min-height: 400px;
    padding: 20px;
    display: none;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.result-page.active {
    display: flex; /* flex로 변경 */
    flex-direction: column;
    opacity: 1;
    transform: translateX(0);
}

.result-page.prev {
    transform: translateX(-100%);
}

/* 최종 순위 스타일 */
.final-rankings {
    max-height: 400px;
    overflow-y: auto;
    padding: 10px 0;
}

.final-rank-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    margin: 8px 0;
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.2);
    gap: 15px;
}

.final-rank-item.winner {
    background: linear-gradient(45deg, rgba(231,76,60,0.3), rgba(192,57,43,0.3));
    border-color: #e74c3c;
    box-shadow: 0 0 15px rgba(231,76,60,0.2);
}

.final-rank-number {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0;
}

.final-rank-number.rank-1 { 
    background: linear-gradient(45deg, #FFD700, #FFA500); 
    color: #000; 
}
.final-rank-number.rank-2 { 
    background: linear-gradient(45deg, #C0C0C0, #A0A0A0); 
    color: #000; 
}
.final-rank-number.rank-3 { 
    background: linear-gradient(45deg, #CD7F32, #B8860B); 
    color: #fff; 
}
.final-rank-number.other { 
    background: linear-gradient(45deg, #6c5ce7, #a29bfe); 
    color: #fff; 
}

.final-rank-character {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.final-rank-info {
    flex: 1;
}

.final-rank-name {
    font-size: 16px;
    font-weight: bold;
    color: white;
    margin-bottom: 2px;
}

.final-rank-status {
    font-size: 12px;
    color: rgba(255,255,255,0.8);
}

.winner-badge {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: white;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: bold;
    margin-left: 10px;
    display: flex;
    align-items: center;
    gap: 3px;
}

/* 페이지 인디케이터 */
.page-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 15px 0;
}

.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.indicator.active {
    background: #feca57;
    transform: scale(1.2);
}

/* 네비게이션 버튼을 팝업 내부로 */
.carousel-nav {
    position: absolute;
    top: 50%;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    transform: translateY(-50%);
    z-index: 10;
}

.nav-btn {
    background: rgba(0,0,0,0.7);
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: all;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.nav-btn:hover {
    background: rgba(0,0,0,0.9);
    transform: scale(1.1);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

/* 팝업에 relative 포지션 추가 */
.result-popup {
    position: relative; /* 이게 중요! */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden; /* 버튼이 팝업 밖으로 나가지 않도록 */
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
}
/* 모바일 최적화 */
@media (max-width: 768px) {
    .result-page {
        min-height: 350px;
        padding: 15px;
    }
    
    .final-rank-item {
        padding: 10px 12px;
        gap: 12px;
    }
    
    .final-rank-number {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
    
    .final-rank-character {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
    
    .final-rank-name {
        font-size: 14px;
    }
    
    .final-rank-status {
        font-size: 11px;
    }
    
    .nav-btn {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
}

/* styles.css에 추가할 순위표 스킬 효과 CSS */

/* 🟡 버프 스킬 효과 (부스트) - 금색 */
.ranking-item.player-boosted {
    background: linear-gradient(45deg, rgba(255,215,0,0.25), rgba(255,165,0,0.25)) !important;
    border: 2px solid #FFD700 !important;
    box-shadow: 0 0 15px rgba(255,215,0,0.4), inset 0 0 10px rgba(255,215,0,0.1) !important;
    animation: boost-glow 1s ease-in-out infinite alternate;
}

/* 🔴 너프 스킬 효과 (스턴) - 빨간색 */
.ranking-item.player-stunned {
    background: linear-gradient(45deg, rgba(255,71,87,0.25), rgba(255,56,56,0.25)) !important;
    border: 2px solid #ff4757 !important;
    box-shadow: 0 0 15px rgba(255,71,87,0.4), inset 0 0 10px rgba(255,71,87,0.1) !important;
    animation: stun-shake 0.5s ease-in-out infinite;
}

/* 🟡 부스트 글로우 애니메이션 */
@keyframes boost-glow {
    0% { 
        box-shadow: 0 0 15px rgba(255,215,0,0.4), inset 0 0 10px rgba(255,215,0,0.1);
        border-color: #FFD700;
    }
    100% { 
        box-shadow: 0 0 25px rgba(255,215,0,0.6), inset 0 0 15px rgba(255,215,0,0.2);
        border-color: #FFA500;
    }
}

/* 🔴 스턴 흔들림 애니메이션 */
@keyframes stun-shake {
    0%, 100% { 
        transform: translateX(0) scale(1);
        box-shadow: 0 0 15px rgba(255,71,87,0.4), inset 0 0 10px rgba(255,71,87,0.1);
    }
    25% { 
        transform: translateX(-2px) scale(0.98);
        box-shadow: 0 0 20px rgba(255,71,87,0.5), inset 0 0 12px rgba(255,71,87,0.15);
    }
    75% { 
        transform: translateX(2px) scale(0.98);
        box-shadow: 0 0 20px rgba(255,71,87,0.5), inset 0 0 12px rgba(255,71,87,0.15);
    }
}

/* 🆕 스킬 효과 중인 플레이어 이름 색상 변경 */
.ranking-item.player-boosted .rank-name {
    color: #FFD700 !important;
    text-shadow: 0 0 8px rgba(255,215,0,0.6) !important;
}

.ranking-item.player-stunned .rank-name {
    color: #ff6b6b !important;
    text-shadow: 0 0 8px rgba(255,107,107,0.6) !important;
}

/* 🆕 스킬 효과 중인 순위 번호 강조 */
.ranking-item.player-boosted .rank-number {
    border: 2px solid #FFD700 !important;
    box-shadow: 0 0 10px rgba(255,215,0,0.5) !important;
}

.ranking-item.player-stunned .rank-number {
    border: 2px solid #ff4757 !important;
    box-shadow: 0 0 10px rgba(255,71,87,0.5) !important;
}

/* 모바일 최적화 */
@media (max-width: 768px) {
    .ranking-item.player-boosted,
    .ranking-item.player-stunned {
        border-width: 1px !important;
    }
    
    @keyframes boost-glow {
        0% { 
            box-shadow: 0 0 10px rgba(255,215,0,0.3), inset 0 0 5px rgba(255,215,0,0.1);
        }
        100% { 
            box-shadow: 0 0 15px rgba(255,215,0,0.5), inset 0 0 8px rgba(255,215,0,0.15);
        }
    }
    
    @keyframes stun-shake {
        0%, 100% { 
            transform: translateX(0) scale(1);
            box-shadow: 0 0 10px rgba(255,71,87,0.3), inset 0 0 5px rgba(255,71,87,0.1);
        }
        25% { 
            transform: translateX(-1px) scale(0.99);
            box-shadow: 0 0 12px rgba(255,71,87,0.4), inset 0 0 6px rgba(255,71,87,0.12);
        }
        75% { 
            transform: translateX(1px) scale(0.99);
            box-shadow: 0 0 12px rgba(255,71,87,0.4), inset 0 0 6px rgba(255,71,87,0.12);
        }
    }
}
/* 추월 알림 팝업 애니메이션 */
@keyframes overtakePopup {
    0% { 
        transform: translateX(-50%) scale(0.5) translateY(-20px); 
        opacity: 0; 
    }
    15% { 
        transform: translateX(-50%) scale(1.1) translateY(0px); 
        opacity: 1; 
    }
    30% { 
        transform: translateX(-50%) scale(1) translateY(0px); 
        opacity: 1; 
    }
    85% { 
        transform: translateX(-50%) scale(1) translateY(0px); 
        opacity: 1; 
    }
    100% { 
        transform: translateX(-50%) scale(0.8) translateY(-10px); 
        opacity: 0; 
    }
}

/* 추월 알림 스타일 */
.overtake-notification {
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
}

/* 모바일 최적화 */
@media (max-width: 768px) {
    .overtake-notification {
        top: 8% !important;
        font-size: 12px !important;
        padding: 6px 12px !important;
        max-width: 280px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .overtake-notification {
        top: 5% !important;
        font-size: 11px !important;
        padding: 5px 10px !important;
        max-width: 250px;
    }
}

/* 🆕 2열 게임 설정 컨테이너 */
.game-settings-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin-bottom: 15px;
  
}

/* 🆕 게임 시간 선택 (왼쪽) */
.game-time-selector {
    text-align: center;
}

.game-time-selector label {
    display: block;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 8px;
}

.time-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.time-btn {
    padding: 8px 12px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 10px;
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 40px;
    position: relative;
    touch-action: manipulation;
}

.time-btn:hover {
    background: rgba(255,255,255,0.2);
}

.time-btn.active {
    background: linear-gradient(45deg, #00b894, #00a085);
    border-color: #00b894;
}

.time-btn .time-recommended {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    color: white;
    font-size: 8px;
    padding: 2px 4px;
    border-radius: 8px;
    font-weight: bold;
}

@media (max-width: 380px) {
    .time-btn {
        gap: 5px;
    }
    
    .time-btn {
        padding: 6px 8px;
        font-size: 11px;
        min-height: 35px;
    }
}



/* styles.css에 추가할 로딩 페이지 스타일 */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9998;
    backdrop-filter: blur(10px);
}

.loading-overlay.show {
    display: flex;
}

.loading-container {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(15px);
    border-radius: 25px;
    padding: 40px 30px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    border: 2px solid rgba(255,255,255,0.2);
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    color: white;
}

/* 로딩 애니메이션 */
.loading-animation {
    width: 150px;
    height: 150px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.loading-animation svg {
    width: 80% !important;
    height: 80% !important;
}

/* 로딩 텍스트 */
.loading-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 25px;
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 게임 설정 요약 */
.game-settings-summary {
    background: rgba(255,255,255,0.08);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid rgba(255,255,255,0.15);
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 16px;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-label {
    color: rgba(255,255,255,0.8);
    font-weight: 500;
}

.setting-value {
    color: #feca57;
    font-weight: bold;
    background: rgba(254,202,87,0.1);
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid rgba(254,202,87,0.2);
}

/* 게임 팁 */
.game-tip-container {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255,255,255,0.08);
    border-radius: 15px;
    padding: 15px 20px;
    margin-bottom: 25px;
    border: 1px solid rgba(255,255,255,0.15);
}

.tip-icon {
    font-size: 24px;
    flex-shrink: 0;
    animation: tip-glow 2s ease-in-out infinite alternate;
}

@keyframes tip-glow {
    0% { transform: scale(1); filter: brightness(1); }
    100% { transform: scale(1.1); filter: brightness(1.3); }
}

.game-tip {
    font-size: 14px;
    line-height: 1.4;
    color: rgba(255,255,255,0.9);
    text-align: left;
    font-weight: 500;
}

/* 로딩 프로그레스 */
.loading-progress {
    margin-top: 20px;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b, #feca57, #00b894);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
    position: relative;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: progress-shimmer 2s linear infinite;
}

@keyframes progress-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.loading-percentage {
    font-size: 14px;
    color: rgba(255,255,255,0.8);
    font-weight: bold;
}

/* 모바일 최적화 */
@media (max-width: 768px) {
    .loading-container {
        padding: 30px 25px;
        max-width: 350px;
    }
    
    .loading-animation {
        width: 100px;
        height: 100px;
    }
    
    .loading-title {
        font-size: 20px;
        margin-bottom: 20px;
    }
    
    .game-settings-summary {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .setting-item {
        font-size: 14px;
        margin-bottom: 10px;
    }
    
    .setting-value {
        font-size: 13px;
        padding: 3px 6px;
    }
    
    .game-tip-container {
        padding: 12px 15px;
        margin-bottom: 20px;
    }
    
    .tip-icon {
        font-size: 20px;
    }
    
    .game-tip {
        font-size: 12px;
    }
}

@media (max-width: 380px) {
    .loading-container {
        padding: 25px 20px;
        max-width: 320px;
    }
    
    .loading-animation {
       width: 100px;
        height: 100px;
    }
    
    .loading-title {
        font-size: 18px;
    }
    
    .setting-item {
        font-size: 13px;
    }
    
    .game-tip {
        font-size: 11px;
    }

}
