/* 읽기 연습 게임 스타일시트 */

:root {
    --primary-color: #4a90d9;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --danger-color: #f44336;
    --background-color: #f5f7fa;
    --card-background: #ffffff;
    --text-color: #333333;
    --text-muted: #666666;
    --border-radius: 12px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Hiragino Kaku Gothic ProN', 'メイリオ', Meiryo, sans-serif;
    background: var(--background-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* 게임 컨테이너 */
.game-container {
    width: 100%;
    max-width: 600px;
    background: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

/* 헤더 */
.game-header {
    text-align: center;
    margin-bottom: 24px;
}

.game-header h1 {
    font-size: 1.8rem;
    color: var(--text-color);
    margin-bottom: 8px;
}

.game-header .subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* 상태 바 */
.status-bar {
    display: flex;
    justify-content: space-around;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 24px;
}

.status-bar > div {
    text-align: center;
}

.status-bar .label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.status-bar .value {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-color);
}

/* 문장 카드 영역 */
.sentence-area {
    margin-bottom: 24px;
}

.sentence-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--border-radius);
    padding: 32px 24px;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.sentence-card.correct {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    animation: pulse 0.5s ease;
}

.sentence-card.incorrect {
    background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    animation: shake 0.5s ease;
}

.sentence-card.paused {
    background: linear-gradient(135deg, #a8a8a8 0%, #6b6b6b 100%);
    opacity: 0.8;
}

.sentence-text {
    color: white;
    font-size: 1.3rem;
    line-height: 2;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 루비(후리가나) 스타일 */
.sentence-text ruby {
    ruby-position: over;
}

.sentence-text rt {
    font-size: 0.55em;
    color: rgba(255, 255, 255, 0.9);
}

.sentence-text rp {
    display: none;
}

/* 음성 인식 피드백 */
.speech-feedback {
    margin-bottom: 24px;
}

.recognized-text {
    padding: 16px;
    background: #e8f4fd;
    border-radius: 8px;
    text-align: center;
    font-size: 1rem;
    color: var(--primary-color);
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.recognized-text.listening {
    background: #e8f5e9;
    color: var(--success-color);
    animation: pulse 1.5s infinite;
}

.recognized-text.matched {
    background: #e8f5e9;
    color: var(--success-color);
    font-weight: bold;
}

.recognized-text.not-matched {
    background: #ffebee;
    color: var(--danger-color);
}

/* 타이머 경고 */
#timer.warning {
    color: var(--warning-color) !important;
}

#timer.danger {
    color: var(--danger-color) !important;
    animation: blink 0.5s infinite;
}

/* 게임 컨트롤 */
.game-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn {
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-start {
    background: var(--primary-color);
    color: white;
}

.btn-start:hover:not(:disabled) {
    background: #357abd;
    transform: translateY(-2px);
}

.btn-pause {
    background: #ff9800;
    color: white;
}

.btn-pause:hover:not(:disabled) {
    background: #f57c00;
    transform: translateY(-2px);
}

.btn-skip {
    background: #e0e0e0;
    color: var(--text-color);
}

.btn-skip:hover:not(:disabled) {
    background: #bdbdbd;
}

.btn-restart {
    background: var(--success-color);
    color: white;
}

.btn-restart:hover {
    background: #43a047;
}

.btn-back {
    background: var(--text-muted);
    color: white;
}

.btn-back:hover {
    background: #555;
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 32px;
    border-radius: var(--border-radius);
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: modalIn 0.3s ease;
}

.modal-content h2 {
    font-size: 1.5rem;
    margin-bottom: 16px;
    color: var(--success-color);
}

.result-text {
    color: var(--text-muted);
    margin-bottom: 24px;
}

.result-stats {
    background: #f5f5f5;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    text-align: left;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.stat-row:last-child {
    border-bottom: none;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* 애니메이션 */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 반응형 */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .game-container {
        padding: 16px;
    }

    .game-header h1 {
        font-size: 1.4rem;
    }

    .sentence-text {
        font-size: 1.1rem;
        line-height: 1.8;
    }

    .sentence-card {
        padding: 24px 16px;
        min-height: 120px;
    }

    .status-bar {
        flex-wrap: wrap;
        gap: 12px;
        padding: 12px;
    }

    .status-bar > div {
        flex: 1 1 30%;
        min-width: 80px;
    }

    .game-controls {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .modal-buttons {
        flex-direction: column;
    }

    .modal-buttons .btn {
        width: 100%;
    }
}
