/* style.css - Apple Style Dark Theme */
:root {
    /* Apple Palette */
    --apple-bg: #000000;
    --apple-surface: #1c1c1e;
    --apple-surface-hover: #2c2c2e;
    --apple-text: #ffffff;
    --apple-text-secondary: #86868b;
    
    --apple-blue: #0A84FF;
    --apple-red: #FF453A;
    --apple-green: #32D74B;
    --apple-yellow: #FFD60A;
    
    --glass-bg: rgba(28, 28, 30, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* { 
    margin: 0; padding: 0; box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", "Helvetica Neue", Arial, sans-serif;
    background-color: var(--apple-bg);
    color: var(--apple-text);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-height: 100vh;
    padding: 20px 0;
    overflow-x: hidden;
    position: relative;
    letter-spacing: -0.3px;
}

/* 감각적인 앰비언트 배경 (애플뮤직 스타일) */
.ambient-background {
    position: fixed;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle at 50% 30%, rgba(10, 132, 255, 0.15), transparent 40%),
                radial-gradient(circle at 30% 70%, rgba(255, 69, 58, 0.1), transparent 40%);
    z-index: -1; pointer-events: none;
    animation: ambientShift 15s ease-in-out infinite alternate;
}
@keyframes ambientShift {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.1) translate(5%, -5%); }
}

/* 글래스모피즘 컨테이너 */
.container {
    background: var(--glass-bg);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 40px;
    width: 90%; max-width: 500px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    margin-bottom: 120px; 
    z-index: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* 헤더 & 언어버튼 */
.header-tools { position: absolute; top: 20px; right: 20px; }
.lang-btn {
    background: var(--apple-surface-hover);
    color: var(--apple-text);
    padding: 6px 12px; border-radius: 14px;
    font-size: 0.85rem; font-weight: 600; text-decoration: none;
    transition: all 0.2s ease;
}
.lang-btn:hover { background: var(--apple-blue); color: #fff; }

.screen { 
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 55vh; width: 100%; text-align: center;
}

/* 타이포그래피 */
.icon-wrapper { font-size: 4rem; margin-bottom: 10px; }
.title { font-size: 2.2rem; font-weight: 800; letter-spacing: -1px; margin-bottom: 5px; }
.subtitle { font-size: 1.2rem; font-weight: 500; color: var(--apple-blue); margin-bottom: 25px; }
.description { font-size: 1.05rem; line-height: 1.6; color: var(--apple-text-secondary); margin-bottom: 35px; }
.highlight { color: var(--apple-text); font-weight: 600; }

/* 공통 버튼 디자인 (Apple 스타일 곡선) */
.btn {
    font-family: inherit; font-size: 1.1rem; font-weight: 600;
    border: none; padding: 18px 30px; border-radius: 20px;
    cursor: pointer; width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.2s;
}
.btn:active { transform: scale(0.96); }

.btn-primary { background-color: var(--apple-text); color: var(--apple-bg); }
.btn-primary:hover { opacity: 0.9; }

.btn-secondary { background-color: var(--apple-surface-hover); color: var(--apple-text); }
.btn-kakao { background-color: #FEE500; color: #000000; }

/* 게임 화면 UI */
.progress-container {
    display: flex; justify-content: space-between; align-items: center;
    width: 100%; background: rgba(0,0,0,0.3); padding: 12px 20px; border-radius: 16px; margin-bottom: 20px;
}
.stage { font-size: 1.1rem; font-weight: 600; color: var(--apple-text-secondary); }
.timer { font-family: -apple-system, monospace; font-size: 1.6rem; font-weight: 700; color: var(--apple-text); font-variant-numeric: tabular-nums; }

.game-area { flex-grow: 1; display: flex; flex-direction: column; justify-content: center; padding: 30px 0; }
.instruction { font-size: 1rem; color: var(--apple-text-secondary); font-weight: 500; margin-bottom: 10px; }

.word-display {
    font-size: 4.5rem; font-weight: 900; letter-spacing: -2px;
    height: 100px; display: flex; align-items: center; justify-content: center;
    text-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

/* 컬러 버튼 및 키보드 힌트 */
.color-buttons {
    display: grid; grid-template-columns: 1fr 1fr; gap: 15px; width: 100%; max-width: 320px;
}
.color-btn {
    height: 90px; border-radius: 24px; border: none; cursor: pointer;
    box-shadow: inset 0 2px 5px rgba(255,255,255,0.3), 0 10px 20px rgba(0,0,0,0.3);
    transition: transform 0.15s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s;
    position: relative; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 10px;
}
.color-btn:active, .color-btn.active { transform: scale(0.92); opacity: 0.8; }

.key-hint {
    background: rgba(0,0,0,0.3); color: rgba(255,255,255,0.9);
    font-size: 0.9rem; font-weight: 700; padding: 4px 10px; border-radius: 10px;
    backdrop-filter: blur(5px); pointer-events: none;
}

/* 결과 화면 */
.result-img {
    width: 130px; height: 130px; margin: 0 auto 20px; border-radius: 50%;
    object-fit: cover; border: 4px solid var(--apple-surface-hover);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.result-title { font-size: 1.8rem; font-weight: 800; margin-bottom: 10px; letter-spacing: -0.5px; }
.result-description { font-size: 1.05rem; line-height: 1.5; color: var(--apple-text-secondary); margin-bottom: 20px; }
.result-score { font-size: 2.5rem; font-weight: 800; color: var(--apple-blue); margin-bottom: 30px; font-variant-numeric: tabular-nums; }

.share-buttons { display: flex; gap: 12px; margin-bottom: 25px; width: 100%; }
.share-buttons .btn { flex: 1; padding: 16px; font-size: 1rem; border-radius: 18px; }

.divider {
    width: 100%; text-align: center; margin: 30px 0 15px; font-size: 0.9rem;
    color: var(--apple-text-secondary); text-transform: uppercase; letter-spacing: 1px; font-weight: 600;
}

.more-tests { display: grid; grid-template-columns: 1fr; gap: 10px; width: 100%; }
.more-item {
    background: var(--apple-surface-hover); color: var(--apple-text);
    font-size: 1rem; font-weight: 500; padding: 16px; border-radius: 16px; text-decoration: none;
    transition: background 0.2s; display: block;
}
.more-item:hover { background: rgba(255,255,255,0.15); }

/* 토스트 팝업 */
.toast-popup {
    visibility: hidden; min-width: 200px;
    background: rgba(44, 44, 46, 0.9); color: #fff;
    text-align: center; border-radius: 20px; padding: 12px 20px;
    position: fixed; z-index: 10000; left: 50%; transform: translateX(-50%);
    bottom: 40px; font-size: 1rem; font-weight: 500; opacity: 0;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    backdrop-filter: blur(10px); box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.toast-popup.show { visibility: visible; opacity: 1; bottom: 80px; }

/* 광고 영역 */
.ad-container-fixed {
    position: fixed; bottom: 0; left: 0; width: 100%;
    background-color: rgba(28, 28, 30, 0.8); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border); z-index: 10;
    display: flex; justify-content: center; align-items: center; padding: 10px 0;
    padding-bottom: env(safe-area-inset-bottom, 10px); /* iOS 노치 하단 여백 대응 */
}

/* 애니메이션 */
.animate-fade-in { animation: fadeIn 0.6s ease forwards; }
.animate-fade-up { animation: fadeUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.animate-pop { animation: pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.shake { animation: shake-error 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pop { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes shake-error {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* 모바일 대응 */
@media (max-width: 600px) {
    .container { padding: 30px 20px; border-radius: 28px; margin-bottom: 100px; width: 92%; }
    .title { font-size: 1.8rem; }
    .word-display { font-size: 3.5rem; height: 80px; }
    .color-btn { height: 80px; border-radius: 20px; }
    .timer { font-size: 1.4rem; }
    .btn { padding: 16px 20px; font-size: 1.05rem; }
    .share-buttons { flex-direction: column; gap: 10px; }
}

/* 카운트다운 화면 */
.countdown-display {
    font-size: 8rem;
    font-weight: 900;
    letter-spacing: -2px;
    color: var(--apple-text);
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}