/* =============================================
   청력 테스트 게임 스타일
   ============================================= */

html { background: #000; }

.ht-body {
    overflow: hidden;
    height: 100dvh;
    max-width: 480px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #f0f0f0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* Game Area */
.ht-game {
    width: 100%;
    height: 100dvh;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Top Bar */
.ht-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    z-index: 10;
    flex-shrink: 0;
}
.ht-back {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
}
.ht-back:hover { color: #fff; }
.ht-info-badge {
    font-size: 13px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.2);
}

/* Content */
.ht-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 24px;
    overflow-y: auto;
}

/* ===== States ===== */

/* Intro */
.state-intro { background: #0a1628; }
.state-intro .ht-content {
    justify-content: flex-start;
    padding-top: 40px;
}

.ht-intro-emoji { font-size: 72px; margin-bottom: 16px; }
.ht-intro-title {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 8px;
}
.ht-intro-desc {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.6;
    margin-bottom: 24px;
    text-align: center;
}
.ht-intro-desc strong { color: #38bdf8; }

.ht-best {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 10px 18px;
    margin-bottom: 12px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.ht-warning {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: 12px 18px;
    margin-bottom: 24px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    line-height: 1.5;
}

.ht-btn-start {
    display: inline-block;
    padding: 16px 48px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s;
}
.ht-btn-start:active { transform: scale(0.95); }

/* Playing */
.state-playing { background: #0a1628; }
.state-playing .ht-content {
    justify-content: center;
}

.ht-freq-display {
    font-size: 48px;
    font-weight: 900;
    color: #38bdf8;
    margin-bottom: 4px;
}
.ht-freq-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 24px;
}

.ht-progress {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 16px;
}

/* Sound wave animation */
.ht-wave-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 80px;
    margin-bottom: 32px;
}
.ht-wave-bar {
    width: 6px;
    border-radius: 3px;
    background: #2563eb;
    animation: htWave 0.8s ease-in-out infinite alternate;
}
.ht-wave-bar:nth-child(1) { height: 20px; animation-delay: 0s; }
.ht-wave-bar:nth-child(2) { height: 35px; animation-delay: 0.1s; }
.ht-wave-bar:nth-child(3) { height: 50px; animation-delay: 0.2s; }
.ht-wave-bar:nth-child(4) { height: 65px; animation-delay: 0.3s; }
.ht-wave-bar:nth-child(5) { height: 50px; animation-delay: 0.4s; }
.ht-wave-bar:nth-child(6) { height: 35px; animation-delay: 0.5s; }
.ht-wave-bar:nth-child(7) { height: 20px; animation-delay: 0.6s; }

@keyframes htWave {
    0% { transform: scaleY(0.3); opacity: 0.5; }
    100% { transform: scaleY(1); opacity: 1; }
}

.ht-playing-text {
    font-size: 16px;
    color: #38bdf8;
    font-weight: 600;
    margin-bottom: 8px;
}

.ht-countdown {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 32px;
}

.ht-btn-group {
    display: flex;
    gap: 16px;
    width: 100%;
    max-width: 320px;
}
.ht-btn-heard, .ht-btn-not-heard {
    flex: 1;
    padding: 18px 16px;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s;
}
.ht-btn-heard:active, .ht-btn-not-heard:active { transform: scale(0.95); }

.ht-btn-heard {
    background: #22c55e;
    color: #fff;
}
.ht-btn-not-heard {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Wait state */
.ht-wait-text {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 16px;
}
.ht-wait-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 32px;
}
.ht-wait-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    animation: htDotPulse 1.2s ease-in-out infinite;
}
.ht-wait-dot:nth-child(2) { animation-delay: 0.2s; }
.ht-wait-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes htDotPulse {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* Result — 공통 game-result.css 사용 */
.state-result { background: #0a1628; }
.state-result .ht-content {
    justify-content: flex-start;
    padding-top: 32px;
}

/* Freq chart (결과 내 고유 차트 — 공통 아님) */
.ht-freq-chart {
    width: 100%;
    max-width: 360px;
    margin-bottom: 20px;
}
.ht-freq-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 12px;
}
.ht-freq-hz {
    width: 60px;
    text-align: right;
    color: rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
}
.ht-freq-bar-wrap {
    flex: 1;
    height: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
}
.ht-freq-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}
.ht-freq-bar-heard {
    background: #22c55e;
}
.ht-freq-bar-not {
    background: #ef4444;
    opacity: 0.5;
}
.ht-freq-status {
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

/* Toast */
.ht-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    white-space: nowrap;
}
.ht-toast-show {
    opacity: 1;
    pointer-events: auto;
}
