/* style.css - 변경 없음, 이전과 동일 */
@import url('https://fonts.googleapis.com/css2?family=Jua:wght@400;700&family=Orbitron:wght@400;700;900&display=swap');

:root {
    --primary-color: #00d4ff; /* 청량한 블루 - 순발력 상징 */
    --secondary-color: #ff6b6b; /* 에너지 넘치는 레드 - 챌린지 */
    --bg-color: #0a0a0a; /* 다크 모드 배경 - 집중 유도 */
    --surface-color: #1a1a1a;
    --text-color: #ffffff;
    --subtext-color: #b0b0b0;
    --accent-color: #ffd700; /* 골드 - 완벽 타이밍 */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Jua', sans-serif;
    background: linear-gradient(135deg, var(--bg-color) 0%, #1a1a2e 100%);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    text-align: center;
    padding: 20px 0;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(0,212,255,0.1) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
    animation: bg-pulse 4s ease-in-out infinite alternate;
}

@keyframes bg-pulse {
    0% { opacity: 0.5; transform: scale(1); }
    100% { opacity: 1; transform: scale(1.1); }
}

.container {
    background-color: var(--surface-color);
    border-radius: 25px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(0,212,255,0.2);
    width: 90%;
    max-width: 500px;
    position: relative;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0,212,255,0.3);
    animation: container-glow 2s ease-in-out infinite alternate;
    margin-bottom: 120px; /* 하단 광고 공간 확보 */
    z-index: 1;
}

@keyframes container-glow {
    0% { box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(0,212,255,0.2); }
    100% { box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 50px rgba(0,212,255,0.4); }
}

.language-toggle {
    position: absolute;
    top: 15px;
    right: 15px;
}

.lang-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--primary-color);
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.lang-btn:hover {
    background: var(--primary-color);
    transform: scale(1.05);
}

.screen { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
    min-height: 60vh;
}

.title { 
    color: var(--primary-color); 
    font-size: 2.5rem; 
    margin-bottom: 15px; 
    line-height: 1.2; 
    font-family: 'Orbitron', monospace;
    text-shadow: 0 0 20px rgba(0,212,255,0.5);
    animation: title-glow 1.5s ease-in-out infinite alternate;
}

@keyframes title-glow {
    0% { text-shadow: 0 0 20px rgba(0,212,255,0.5); }
    100% { text-shadow: 0 0 30px rgba(0,212,255,0.8), 0 0 40px rgba(0,212,255,0.4); }
}

.description { 
    font-size: 1.2rem; 
    margin-bottom: 35px; 
    line-height: 1.6; 
    color: var(--subtext-color);
    animation: fade-in-up 1s ease;
}

@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.btn {
    font-family: 'Jua', sans-serif;
    background: linear-gradient(45deg, var(--primary-color), #00aaff);
    color: #fff;
    border: none;
    padding: 18px 35px;
    border-radius: 50px;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    text-decoration: none;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 10px 20px rgba(0,212,255,0.3);
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover { 
    background: linear-gradient(45deg, #00aaff, var(--primary-color));
    transform: translateY(-3px) scale(1.02); 
    box-shadow: 0 15px 30px rgba(0,212,255,0.4);
}

.start-btn {
    max-width: 250px;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0% { box-shadow: 0 0 20px rgba(0,212,255,0.5); }
    50% { box-shadow: 0 0 30px rgba(0,212,255,0.8); }
    100% { box-shadow: 0 0 20px rgba(0,212,255,0.5); }
}

/* 테스트 화면 */
#test-screen {
    animation: slide-in-left 0.5s ease;
}

@keyframes slide-in-left {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.timer {
    font-family: 'Orbitron', monospace;
    font-size: 4rem;
    font-weight: 900;
    color: var(--accent-color);
    margin-bottom: 20px;
    text-shadow: 0 0 30px var(--accent-color);
    animation: timer-tick 0.1s ease-in-out infinite alternate;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes timer-tick {
    0% { text-shadow: 0 0 30px var(--accent-color); }
    100% { text-shadow: 0 0 40px var(--accent-color), 0 0 50px var(--accent-color); }
}

.stop-btn {
    background: linear-gradient(45deg, var(--secondary-color), #ff5252);
    font-size: 1.5rem;
    padding: 25px 50px;
    max-width: 200px;
    animation: shake 0.5s ease-in-out infinite alternate;
    box-shadow: 0 15px 30px rgba(255,107,107,0.4);
}

@keyframes shake {
    0% { transform: translateX(-5px); }
    100% { transform: translateX(5px); }
}

.stop-btn:hover {
    background: linear-gradient(45deg, #ff5252, var(--secondary-color));
    transform: translateY(-5px) scale(1.05);
}

.instruction {
    font-size: 1.1rem;
    color: var(--subtext-color);
    margin-top: 20px;
    animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.5; }
}

/* 결과 화면 */
.result-img {
    width: 150px;
    height: 150px;
    margin: 20px 0;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary-color);
    box-shadow: 0 0 30px rgba(0,212,255,0.5);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.result-title { 
    color: var(--primary-color); 
    font-size: 2.2rem; 
    margin-bottom: 10px;
    font-family: 'Orbitron', monospace;
}

.result-description {
    font-size: 1.2rem;
    line-height: 1.5;
    margin-bottom: 15px;
    color: var(--subtext-color);
    animation: fade-in 1s ease;
}

.result-score {
    font-size: 3rem;
    font-weight: bold;
    color: var(--accent-color);
    margin: 20px 0;
    text-shadow: 0 0 20px var(--accent-color);
    animation: score-pop 0.5s ease;
}

@keyframes score-pop {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.share-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
}

.share-btn {
    background: linear-gradient(45deg, #28a745, #20c997);
    flex: 1;
    min-width: 120px;
    padding: 15px 20px;
    font-size: 1rem;
}

.share-btn:hover {
    background: linear-gradient(45deg, #20c997, #28a745);
}

.retry-btn {
    background: linear-gradient(45deg, var(--secondary-color), #ff5252);
    margin-bottom: 20px;
}

.more-tests {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
    margin-top: 20px;
}

.more-btn {
    background: linear-gradient(45deg, #6c757d, #495057);
    font-size: 1rem;
    padding: 12px 20px;
    text-align: center;
}

.more-btn:hover {
    background: linear-gradient(45deg, #495057, #6c757d);
    transform: translateX(5px);
}

.toast-popup {
    visibility: hidden;
    min-width: 280px;
    background: rgba(0,0,0,0.9);
    color: #fff;
    text-align: center;
    border-radius: 15px;
    padding: 16px;
    position: fixed;
    z-index: 10000;
    left: 50%;
    transform: translateX(-50%);
    bottom: 50px;
    font-size: 1.1rem;
    font-family: 'Jua', sans-serif;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    border: 1px solid var(--primary-color);
}

.toast-popup.show {
    visibility: visible;
    opacity: 1;
    bottom: 80px;
    animation: toast-slide 0.5s ease;
}

@keyframes toast-slide {
    from { bottom: 50px; opacity: 0; }
    to { bottom: 80px; opacity: 1; }
}

/* 하단 고정 광고 */
.ad-container-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--surface-color);
    border-top: 1px solid rgba(0,212,255,0.3);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
}

/* 애니메이션 클래스 */
.animate-fade-in { animation: fade-in 1s ease; }
.animate-slide-up { animation: fade-in-up 1s ease; }
.animate-zoom-in { animation: zoom-in 0.8s ease; }
.animate-bounce { animation: bounce 1s ease-in-out infinite; }
.animate-pulse { animation: pulse-glow 2s ease-in-out infinite; }

@keyframes zoom-in {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 반응형 디자인 */
@media (max-width: 600px) {
    body {
        padding: 10px 0;
    }
    
    .container { 
        padding: 20px; 
        margin-bottom: 100px; /* 모바일에서 하단 광고 공간 조정 */
        width: 95%;
        border-radius: 15px;
    }
    
    .title { 
        font-size: 2rem; 
    }
    
    .description { 
        font-size: 1rem; 
    }
    
    .timer { 
        font-size: 3rem; 
    }
    
    .stop-btn {
        padding: 20px 40px;
        font-size: 1.3rem;
    }
    
    .share-buttons { 
        flex-direction: column; 
        gap: 10px;
    }
    
    .share-btn {
        min-width: auto;
    }
    
    .more-btn {
        font-size: 0.9rem;
        padding: 10px 15px;
    }
    
    .ad-container-fixed {
        padding: 5px 0;
    }
    
    .lang-btn {
        font-size: 0.8rem;
        padding: 6px 10px;
    }
}

@media (max-width: 400px) {
    .title { 
        font-size: 1.8rem; 
    }
    
    .timer { 
        font-size: 2.5rem; 
    }
    
    .result-score {
        font-size: 2.5rem;
    }
}