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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0f0f0f;
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
}

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

h1 {
    font-size: 2rem;
    color: #fff;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: #888;
    margin-bottom: 2rem;
}

/* Piano */
.piano-section {
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.piano {
    position: relative;
    display: flex;
    height: 160px;
    user-select: none;
}

.key {
    cursor: pointer;
    border-radius: 0 0 4px 4px;
    transition: background 0.08s;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 8px;
    font-size: 10px;
}

.key.white {
    width: 40px;
    height: 160px;
    background: #f0f0f0;
    border: 1px solid #ccc;
    color: #999;
    z-index: 1;
}

.key.white:hover {
    background: #e0e8ff;
}

.key.white.active {
    background: hsl(var(--glow-hue), 90%, 80%);
    animation: glow-pulse 0.6s ease-in-out infinite alternate;
}

.key.black {
    width: 26px;
    height: 100px;
    background: #222;
    border: 1px solid #000;
    color: #666;
    position: absolute;
    z-index: 2;
    font-size: 9px;
}

.key.black:hover {
    background: #3a3a5a;
}

.key.black.active {
    background: hsl(var(--glow-hue), 80%, 45%);
    animation: glow-pulse 0.6s ease-in-out infinite alternate;
}

@keyframes glow-pulse {
    from {
        box-shadow:
            0 0 12px 4px hsla(var(--glow-hue), 100%, 60%, 0.7),
            0 0 30px 10px hsla(var(--glow-hue), 100%, 55%, 0.35);
    }
    to {
        box-shadow:
            0 0 40px 16px hsla(var(--glow-hue), 100%, 70%, 1.0),
            0 0 80px 32px hsla(var(--glow-hue), 100%, 60%, 0.6),
            0 0 120px 48px hsla(var(--glow-hue), 100%, 50%, 0.25);
    }
}

/* Melody Display */
.melody-section {
    margin-bottom: 1.5rem;
}

.melody-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #aaa;
}

.melody-display {
    display: flex;
    gap: 4px;
    padding: 0.75rem;
    background: #1a1a1a;
    border-radius: 6px;
    min-height: 44px;
    overflow-x: auto;
    align-items: center;
    flex-wrap: wrap;
}

.melody-display .placeholder {
    color: #555;
    font-size: 0.85rem;
}

.note-box {
    background: #2a2a4a;
    color: #b0c0ff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}

.note-box:hover {
    background: #4a2a2a;
    color: #ff8080;
}

.note-box.sharp {
    background: #3a2a4a;
    color: #d0a0ff;
}

.warning {
    color: #e8a030;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* Message Section */
.message-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

textarea {
    width: 100%;
    padding: 0.75rem;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    color: #e0e0e0;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.9rem;
    resize: vertical;
}

textarea:focus {
    outline: none;
    border-color: #5566aa;
}

.button-row {
    display: flex;
    gap: 0.75rem;
}

.btn {
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s;
}

.btn-primary {
    background: #3a4a8a;
    color: #fff;
    flex: 1;
}

.btn-primary:hover {
    background: #4a5aaa;
}

.btn-primary:disabled {
    background: #2a2a3a;
    color: #555;
    cursor: not-allowed;
}

.btn-small {
    background: #2a2a2a;
    color: #aaa;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.btn-small:hover {
    background: #3a3a3a;
}
