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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 1100px;
    width: 100%;
    height: 885px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

h1 {
    color: #333;
    font-size: 2em;
    margin: 0;
}

.settings-link {
    text-decoration: none;
    color: #667eea;
    font-size: 1.2em;
    padding: 10px 20px;
    border-radius: 50px;
    transition: all 0.3s;
    background: #f0f0f0;
}

.settings-link:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.controls {
    text-align: center;
    margin-bottom: 5px;
}

.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1em;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 20px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

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

.btn:focus {
    outline: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.note-info {
    font-size: 1.2em;
    color: #667eea;
    font-weight: bold;
    min-height: 30px;
    margin-top: 10px;
}

.staff-container {
    background: white;
    border-radius: 10px;
    padding: 0;
    min-height: 270px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: auto;
}

.piano-container {
    background: white;
    border-radius: 10px;
    padding: 0;
    min-height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.piano-key {
    transition: fill 0.2s ease;
    cursor: default;
}

.white-key:hover {
    fill: #f5f5f5 !important;
}

.black-key:hover {
    fill: #555 !important;
}

/* MIDI コントロール */
.midi-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.btn-midi {
    background: linear-gradient(135deg, #43b581 0%, #2d8f63 100%);
    color: white;
    border: none;
    padding: 10px 24px;
    font-size: 1em;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 0;
}

.btn-midi:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(67, 181, 129, 0.3);
}

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

.midi-status {
    font-size: 0.95em;
    font-weight: bold;
    padding: 6px 14px;
    border-radius: 20px;
}

.elapsed-time {
    font-size: 0.95em;
    font-weight: bold;
    padding: 6px 14px;
    border-radius: 20px;
    color: #666;
    background: #f0f0f0;
}

.clear-times {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    min-height: 32px;
}

.clear-time-item {
    font-size: 0.85em;
    font-weight: bold;
    padding: 4px 10px;
    border-radius: 12px;
    color: #43b581;
    background: #e8f8f0;
}

.midi-status.disconnected {
    color: #999;
    background: #f0f0f0;
}

.midi-status.connected {
    color: #43b581;
    background: #e8f8f0;
}

.midi-status.not-supported {
    color: #e74c3c;
    background: #fde8e8;
}

.midi-status.error {
    color: #e67e22;
    background: #fdf0e0;
}

/* 現在位置ハイライト */
@keyframes positionPulse {
    0% { opacity: 0.4; }
    50% { opacity: 0.7; }
    100% { opacity: 0.4; }
}

.position-highlight {
    pointer-events: none;
}

.position-correct {
    pointer-events: none;
}

/* フィードバックメッセージ */
.midi-feedback {
    text-align: center;
    padding: 6px 12px;
    margin-top: 8px;
    font-size: 0.85em;
    font-weight: bold;
    border-radius: 6px;
}

.midi-feedback.success {
    color: #43b581;
    background: #e8f8f0;
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    h1 {
        font-size: 1.5em;
    }

    .btn {
        font-size: 1em;
        padding: 12px 25px;
    }

    .settings-link {
        font-size: 1em;
    }
}
