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

:root {
    --primary-color: #2C3E50;
    --secondary-color: #3498DB;
    --accent-color: #E74C3C;
    --success-color: #27AE60;
    --warning-color: #F39C12;
    --bg-color: #1A1A1A;
    --surface-color: #2C2C2C;
    --text-color: #ECEFF1;
    --text-secondary: #B0BEC5;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    padding-bottom: 80px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeIn 0.6s ease-out;
}

h1 {
    font-size: 3em;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.2em;
}

.section {
    display: none;
    animation: slideIn 0.4s ease-out;
}

.section.active {
    display: block;
}

/* チュートリアルセクション */
.tutorial-content {
    background: var(--surface-color);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.demo-area {
    display: flex;
    gap: 15px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.demo-btn {
    flex: 1;
    min-width: 150px;
    padding: 15px 20px;
    background: var(--primary-color);
    color: var(--text-color);
    border: none;
    border-radius: 10px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.demo-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

.demo-btn:active {
    transform: translateY(0);
}

.info-box {
    background: rgba(52, 152, 219, 0.1);
    border-left: 4px solid var(--secondary-color);
    padding: 20px;
    margin: 20px 0;
    border-radius: 5px;
}

.info-box p {
    margin: 5px 0;
}

.start-training-btn {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 30px auto 0;
    padding: 15px 30px;
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.start-training-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(52, 152, 219, 0.4);
}

/* 訓練モード */
.level-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: center;
}

.level-btn {
    padding: 10px 25px;
    background: var(--surface-color);
    color: var(--text-secondary);
    border: 2px solid transparent;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.level-btn.active {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.level-btn:hover {
    border-color: var(--secondary-color);
}

.training-area {
    background: var(--surface-color);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.visualization {
    margin-bottom: 30px;
}

#echoCanvas {
    width: 100%;
    max-width: 600px;
    height: auto;
    background: #000;
    border-radius: 10px;
    display: block;
    margin: 0 auto 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.sound-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 25px;
    background: var(--primary-color);
    color: var(--text-color);
    border: none;
    border-radius: 10px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sound-btn:hover {
    background: var(--accent-color);
    transform: scale(1.05);
}

.sound-btn:active {
    transform: scale(0.95);
}

.sound-btn .icon {
    font-size: 1.5em;
}

.challenge-info {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.challenge-info h3 {
    color: var(--secondary-color);
    margin-bottom: 10px;
}

.answer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.answer-btn {
    aspect-ratio: 1;
    background: var(--primary-color);
    border: 2px solid transparent;
    border-radius: 10px;
    color: var(--text-color);
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.answer-btn:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
}

.answer-btn.correct {
    background: var(--success-color);
    animation: pulse 0.6s ease;
}

.answer-btn.incorrect {
    background: var(--accent-color);
    animation: shake 0.5s ease;
}

.feedback {
    text-align: center;
    margin-top: 20px;
    min-height: 50px;
}

.feedback p {
    font-size: 1.1em;
    padding: 10px;
    border-radius: 10px;
    display: inline-block;
}

.feedback.success p {
    background: rgba(39, 174, 96, 0.2);
    color: var(--success-color);
}

.feedback.error p {
    background: rgba(231, 76, 60, 0.2);
    color: var(--accent-color);
}

.progress-bar {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    height: 30px;
    margin-top: 30px;
    position: relative;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(90deg, var(--secondary-color), var(--success-color));
    height: 100%;
    width: 0%;
    border-radius: 20px;
    transition: width 0.5s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
}

/* 統計セクション */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--surface-color);
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card h3 {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: var(--secondary-color);
}

.reset-stats-btn {
    display: block;
    margin: 0 auto;
    padding: 10px 30px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reset-stats-btn:hover {
    background: #C0392B;
    transform: scale(1.05);
}

/* ボトムナビゲーション */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface-color);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.nav-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.nav-btn.active {
    color: var(--secondary-color);
}

.nav-btn:hover {
    color: var(--secondary-color);
}

.nav-btn .icon {
    font-size: 1.5em;
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

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

    h1 {
        font-size: 2em;
    }

    .demo-area {
        flex-direction: column;
    }

    .demo-btn {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .level-selector {
        flex-direction: column;
    }

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