@import url('https://fonts.googleapis.com/css2?family=Jua:wght@400;700&family=Orbitron:wght@400;700;900&display=swap');

:root {
    --primary-color: #00f2ff; /* 사이버펑크 네온 블루 */
    --secondary-color: #ff0055; /* 네온 핑크 */
    --success-color: #00ff88; /* 네온 그린 */
    --bg-color: #050505; 
    --surface-color: rgba(20, 20, 30, 0.8);
    --text-color: #ffffff;
    --subtext-color: #cccccc;
    --accent-color: #ffe600; 
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* 모바일 터치 하이라이트 제거 */
}

body {
    font-family: 'Jua', sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(0, 242, 255, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(255, 0, 85, 0.1) 0%, transparent 40%);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-height: 100vh;
    text-align: center;
    padding: 10px 0;
    overflow-x: hidden;
    touch-action: manipulation; /* 더블탭 줌 방지 */
}

.container {
    background-color: var(--surface-color);
    border-radius: 20px;
    padding: 30px 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    width: 95%;
    max-width: 480px;
    position: relative;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 110px; /* 광고 영역 확보 */
    z-index: 1;
}

/* 언어 버튼 */
.language-toggle {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
}

.lang-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: 0.3s;
    font-family: 'Orbitron', monospace;
    font-weight: bold;
}

/* 화면 공통 */
.screen { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
    width: 100%;
}

.title { 
    color: #fff; 
    font-size: 2.2rem; 
    margin-bottom: 20px; 
    line-height: 1.2; 
    text-shadow: 0 0 10px var(--primary-color);
}

.description { 
    font-size: 1.1rem; 
    margin-bottom: 30px; 
    color: var(--subtext-color);
}

/* 버튼 스타일 */
.btn {
    font-family: 'Jua', sans-serif;
    background: linear-gradient(90deg, var(--primary-color), #00aaff);
    color: #000;
    font-weight: bold;
    border: none;
    padding: 15px 0;
    width: 100%;
    border-radius: 12px;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn:active { transform: scale(0.98); }

.start-btn { animation: pulse-neon 2s infinite; }

/* --- 테스트 화면 UI 개선 --- */
.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    margin-bottom: 15px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px var(--primary-color);
}

.reaction-box {
    width: 100%;
    height: 320px; /* 모바일 최적화 높이 */
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    user-select: none;
    transition: transform 0.1s;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.1);
}

.reaction-box:active { transform: scale(0.98); }

.reaction-box #reaction-text {
    font-size: 2.2rem;
    font-weight: 700;
    pointer-events: none;
    z-index: 2;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.reaction-box .round-counter {
    position: absolute;
    bottom: 15px;
    font-family: 'Orbitron', monospace;
    font-size: 1rem;
    background: rgba(0,0,0,0.4);
    padding: 4px 12px;
    border-radius: 10px;
    z-index: 2;
}

/* 상태별 디자인 */
.reaction-box.waiting {
    background: #ff4757;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.5);
}

.reaction-box.ready {
    background: #2ecc71;
    box-shadow: 0 0 30px #2ecc71, inset 0 0 20px rgba(255,255,255,0.5);
    animation: ready-pulse 0.5s infinite alternate;
}

.reaction-box.early {
    background: #2f3542;
    border: 2px solid var(--secondary-color);
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

.reaction-box.result {
    background: #1e90ff;
}

/* 애니메이션 효과 */
@keyframes pulse-neon {
    0% { box-shadow: 0 0 10px var(--primary-color); }
    50% { box-shadow: 0 0 25px var(--primary-color), 0 0 5px #fff; }
    100% { box-shadow: 0 0 10px var(--primary-color); }
}

@keyframes ready-pulse {
    from { transform: scale(1); }
    to { transform: scale(1.02); }
}

@keyframes shake {
    10%, 90% { transform: translate3d(-2px, 0, 0); }
    20%, 80% { transform: translate3d(4px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
    40%, 60% { transform: translate3d(6px, 0, 0); }
}

/* 기록 리스트 */
.record-list {
    width: 100%;
    margin-top: 15px;
    padding: 0;
    list-style: none;
    max-height: 180px;
    overflow-y: auto;
}

.record-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    margin-bottom: 6px;
    border-radius: 8px;
    font-size: 0.95rem;
    animation: slide-up 0.3s ease;
}

@keyframes slide-up {
    from { transform: translateY(10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* 결과 화면 */
.result-img {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 3px solid var(--primary-color);
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.3);
    margin: 10px 0;
}

.score-box {
    background: rgba(0,0,0,0.3);
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
    width: 100%;
    border: 1px solid rgba(255,255,255,0.1);
}

.result-score {
    font-family: 'Orbitron', monospace;
    font-size: 2.5rem;
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(255, 230, 0, 0.5);
}

.share-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
}

.share-btn {
    font-size: 0.9rem;
    padding: 12px 0;
}

#copy-btn { background: #555; color: #fff; box-shadow: none; }
#kakao-btn { background: #fee500; color: #000; box-shadow: none; }

.more-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: #aaa;
    padding: 10px;
}

/* 광고 영역 */
.ad-container-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #f1f1f1;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    height: 100px; /* 광고 높이 확보 */
}

/* 토스트 */
.toast-popup {
    background: rgba(0,0,0,0.9);
    color: #fff;
    padding: 12px 24px;
    border-radius: 20px;
    position: fixed;
    bottom: 120px; /* 광고 위로 */
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: 0.3s;
    pointer-events: none;
    z-index: 10000;
}
.toast-popup.show { opacity: 1; }

@media (max-height: 700px) {
    .container { padding: 20px; margin-bottom: 100px; }
    .reaction-box { height: 250px; }
}

/* --- 더 보기 (추천 콘텐츠) 그리드 스타일 --- */
.more-tests {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2열 배치 */
    gap: 10px;
    width: 100%;
    margin-top: 20px;
    max-height: 300px; /* 너무 길어지지 않게 스크롤 처리 */
    overflow-y: auto;
    padding-right: 5px; /* 스크롤바 공간 확보 */
}

/* 스크롤바 커스텀 */
.more-tests::-webkit-scrollbar {
    width: 6px;
}
.more-tests::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 10px;
}
.more-tests::-webkit-scrollbar-track {
    background-color: rgba(255, 255, 255, 0.05);
}

/* 프로모션 카드 디자인 */
.promo-card {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 10px 15px;
    text-decoration: none;
    color: #fff;
    transition: all 0.3s ease;
    gap: 10px;
}

.promo-card:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    border-color: var(--primary-color);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.promo-icon {
    font-size: 1.5rem;
}

.promo-text {
    font-family: 'Jua', sans-serif;
    font-size: 0.95rem;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* 긴 텍스트 자르기 */
}

/* 모바일에서는 1열로 보이게 하려면 아래 주석 해제 */
/* 
@media (max-width: 400px) {
    .more-tests {
        grid-template-columns: 1fr;
    }
} 
*/