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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

.main-content {
    padding: 40px;
}

.input-section {
    margin-bottom: 30px;
}

.input-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #555;
    font-size: 1.1em;
}

#poem-input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1em;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
}

#poem-input:focus {
    outline: none;
    border-color: #667eea;
}

.controls-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.melody-selector label,
.midi-status {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #555;
    font-size: 1.1em;
}

#melody-select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1em;
    font-family: inherit;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

#melody-select:focus {
    outline: none;
    border-color: #667eea;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 8px;
    font-size: 0.95em;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e0e0e0;
    display: inline-block;
    transition: background 0.3s;
}

.status-indicator.connected .status-dot {
    background: #4caf50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.btn-primary {
    width: 100%;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

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

.info-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 10px;
}

.current-word p,
.word-index p {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 8px;
}

#current-word-display {
    font-size: 2em;
    font-weight: 700;
    color: #667eea;
    min-height: 50px;
    display: flex;
    align-items: center;
}

.word-index {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.word-index p {
    font-size: 1.1em;
    color: #555;
}

#word-index,
#total-words {
    font-weight: 700;
    color: #667eea;
}

.instructions {
    background: #f0f0f0;
    padding: 25px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.instructions h3 {
    margin-bottom: 15px;
    color: #555;
}

.instructions ol {
    margin-left: 20px;
    line-height: 1.8;
    color: #666;
}

.instructions li {
    margin-bottom: 8px;
}

@media (max-width: 768px) {
    .controls-section {
        grid-template-columns: 1fr;
    }

    .info-section {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 2em;
    }

    .main-content {
        padding: 20px;
    }
}

