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

body {
    font-family: 'Segoe UI', 'Meiryo', sans-serif;
    background: linear-gradient(135deg, #f9d423 0%, #ff4e50 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 1200px;
}

/* 画面切り替え */
.screen {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* スタート画面 */
#startScreen {
    background: white;
    border-radius: 20px;
    padding: 60px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.title-section {
    text-align: center;
    margin-bottom: 50px;
}

.main-title {
    font-size: 3.5em;
    color: #f39c12;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.2em;
    color: #666;
}

.mode-selection {
    margin-bottom: 50px;
}

.mode-selection h2 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 1.8em;
}

.mode-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.mode-btn {
    background: linear-gradient(135deg, #f9d423 0%, #f39c12 100%);
    border: none;
    border-radius: 15px;
    padding: 40px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #333;
    text-align: center;
    font-weight: bold;
}

.mode-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(243, 156, 18, 0.5);
}

.mode-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.mode-name {
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 10px;
}

.mode-desc {
    font-size: 0.9em;
    opacity: 0.9;
}

.stats-preview {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
}

.stats-preview h3 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: 10px;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: #f39c12;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9em;
    color: #666;
}

/* 練習画面 */
#practiceScreen {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    min-height: 600px;
}

.practice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.back-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.3s ease;
}

.back-btn:hover {
    background: #5a6268;
}

.mode-display {
    font-size: 1.3em;
    font-weight: bold;
    color: #333;
}

.timer {
    font-size: 1.5em;
    font-weight: bold;
    color: #f39c12;
    font-family: 'Courier New', monospace;
}

.practice-area {
    max-width: 900px;
    margin: 0 auto;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 10px;
    margin-bottom: 40px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f9d423 0%, #f39c12 100%);
    width: 0%;
    transition: width 0.3s ease;
}

.text-display {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 40px;
    margin-bottom: 30px;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.target-text {
    font-size: 2.5em;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    letter-spacing: 2px;
}

.romaji-text {
    font-size: 1.3em;
    color: #f39c12;
    font-family: 'Courier New', monospace;
    letter-spacing: 3px;
}

/* タイピング進捗表示のスタイル */
.typed-correct {
    color: #28a745;
    font-weight: bold;
}

.typed-incorrect {
    color: #dc3545;
    font-weight: bold;
    text-decoration: underline;
}

.typed-current {
    background-color: #f39c12;
    color: #fff;
    font-weight: bold;
    padding: 2px 4px;
    border-radius: 3px;
    animation: blink 1s infinite;
}

.typed-remaining {
    color: #999;
}

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

.input-area {
    margin-bottom: 40px;
}

.typing-input {
    width: 100%;
    font-size: 2em;
    padding: 20px;
    border: 3px solid #f39c12;
    border-radius: 10px;
    text-align: center;
    font-family: 'Courier New', monospace;
    outline: none;
    transition: all 0.3s ease;
    ime-mode: disabled;
    -ms-ime-mode: disabled;
    -webkit-ime-mode: disabled;
    -moz-ime-mode: disabled;
}

.typing-input:focus {
    border-color: #e67e22;
    box-shadow: 0 0 15px rgba(243, 156, 18, 0.4);
}

.typing-input.correct {
    animation: correctPulse 0.3s ease;
}

.typing-input.incorrect {
    animation: shake 0.3s ease;
    border-color: #dc3545;
}

@keyframes correctPulse {
    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);
    }
}

.stats-display {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.stat-box {
    background: linear-gradient(135deg, #f9d423 0%, #f39c12 100%);
    color: #333;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    font-weight: bold;
}

.stat-title {
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 10px;
}

.stat-number {
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-unit {
    font-size: 0.9em;
    opacity: 0.9;
}

/* 結果画面 */
#resultScreen {
    background: white;
    border-radius: 20px;
    padding: 50px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.result-container {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.result-title {
    font-size: 2.5em;
    color: #333;
    margin-bottom: 30px;
}

.result-grade {
    margin-bottom: 40px;
}

.grade-icon {
    font-size: 5em;
    margin-bottom: 15px;
}

.grade-text {
    font-size: 2em;
    font-weight: bold;
    color: #f39c12;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.result-stat-item {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
}

.result-stat-label {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 10px;
}

.result-stat-value {
    font-size: 2.2em;
    font-weight: bold;
    color: #f39c12;
}

.result-stat-value span {
    font-size: 0.5em;
    color: #999;
}

.result-message {
    background: linear-gradient(135deg, #f9d423 0%, #f39c12 100%);
    color: #333;
    padding: 20px;
    border-radius: 10px;
    font-size: 1.2em;
    margin-bottom: 30px;
    font-weight: bold;
}

.result-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.result-btn {
    padding: 15px 40px;
    font-size: 1.2em;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.retry-btn {
    background: linear-gradient(135deg, #f9d423 0%, #f39c12 100%);
    color: #333;
}

.retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(243, 156, 18, 0.5);
}

.home-btn {
    background: #6c757d;
    color: white;
}

.home-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    #startScreen {
        padding: 40px 20px;
    }

    .main-title {
        font-size: 2.5em;
    }

    .mode-buttons {
        grid-template-columns: 1fr;
    }

    .target-text {
        font-size: 2em;
    }

    .romaji-text {
        font-size: 1.1em;
    }

    .typing-input {
        font-size: 1.5em;
    }

    .stats-display {
        grid-template-columns: 1fr;
    }

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

    .result-btn {
        width: 100%;
    }
}
