/* リセットと基本スタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* コンテナ */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ヘッダー */
.game-header {
    text-align: center;
    margin-bottom: 30px;
}

.game-header h1 {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 10px;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.question-counter, .timer {
    font-size: 1.1rem;
    font-weight: 500;
}

.timer {
    color: #3498db;
}

/* スクリーン共通 */
.screen {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    text-align: center;
}

/* 開始画面 */
#startScreen h2 {
    font-size: 1.8rem;
    color: #2c3e50;
    margin-bottom: 20px;
}

#startScreen p {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: #555;
}

/* ボタン */
.btn {
    font-size: 1.1rem;
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-success {
    background-color: #27ae60;
    color: white;
}

.btn-success:hover {
    background-color: #219a52;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* 問題表示エリア */
.problem-display {
    margin-bottom: 30px;
}

.expression {
    font-size: 3rem;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 10px;
}

.answer-display {
    font-size: 3.5rem;
    font-weight: bold;
    color: #16a085;
    margin-bottom: 20px;
    letter-spacing: 10px;
}

.instruction {
    font-size: 1.2rem;
    color: #7f8c8d;
    font-weight: 500;
}

/* フィードバック */
.feedback {
    min-height: 40px;
    margin-bottom: 20px;
    font-size: 1.2rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.feedback.correct {
    color: #27ae60;
}

.feedback.incorrect {
    color: #e74c3c;
}

/* ソフトキーボード */
.soft-keyboard {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.keyboard-row {
    display: flex;
    gap: 10px;
}

.key {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    font-weight: bold;
    border: 2px solid #bdc3c7;
    background-color: #ecf0f1;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.key:hover {
    background-color: #3498db;
    color: white;
    border-color: #2980b9;
    transform: scale(1.05);
}

.key:active {
    transform: scale(0.95);
}

/* 難易度選択画面 */
.difficulty-options {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
    justify-content: center;
}

.difficulty-card {
    background-color: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    text-align: center;
    min-width: 250px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.difficulty-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.difficulty-card h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #2c3e50;
}

.difficulty-card p {
    font-size: 1rem;
    margin-bottom: 8px;
    color: #555;
}

.difficulty-card p:last-of-type {
    margin-bottom: 20px;
    font-style: italic;
    color: #7f8c8d;
}

/* 結果画面 */
.results {
    margin: 30px 0;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background-color: #f8f9fa;
    border-radius: 6px;
}

.result-item .label {
    font-weight: 500;
    color: #555;
}

.result-item .value {
    font-size: 1.3rem;
    font-weight: bold;
    color: #2c3e50;
}

/* レスポンシブデザイン */
@media (max-width: 600px) {
    .container {
        padding: 10px;
    }

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

    .expression {
        font-size: 2.5rem;
    }

    .answer-display {
        font-size: 3rem;
    }

    .key {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }

    .screen {
        padding: 20px;
    }

    .difficulty-options {
        flex-direction: column;
        gap: 20px;
    }

    .difficulty-card {
        min-width: auto;
    }
}

/* アニメーション */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.screen {
    animation: fadeIn 0.4s ease-out;
}

/* フィードバックアニメーション */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.feedback.incorrect {
    animation: shake 0.5s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.feedback.correct {
    animation: pulse 0.5s ease-in-out;
}

/* カウントダウン表示 */
.countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 50%;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.countdown-number {
    font-size: 8rem;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    animation: countdownPulse 1s ease-in-out;
}

@keyframes countdownPulse {
    0% { 
        transform: scale(0.5);
        opacity: 0;
    }
    50% { 
        transform: scale(1.2);
        opacity: 1;
    }
    100% { 
        transform: scale(1);
        opacity: 1;
    }
}