body {
    margin: 0;
    padding: 0;
    height: 100vh;
    font-family: 'Courier New', monospace;
    color: #ffffff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

#upper-area {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 100px 10px 10px 10px;
    box-sizing: border-box;
    position: relative;
}

#tracker-container {
    display: flex;
    align-items: center;
    position: relative;
}

#tracker-panel {
    width: 180px;
    height: 350px; /* Erhöht auf 18 Zeilen (504px = 12 sichtbar + 6 Zeilen Leerraum oben) */
    margin: 0;
    padding: 0;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    background: #333333; /* Dunkler Hintergrund */
}

#pattern-table {
    flex: 1;
    position: relative;
}

.row {
    display: flex;
    height: 28px;
    align-items: center;
    position: absolute;
    width: auto;
    left: 0;
    transition: background 0.2s ease;
    padding: 0;
    margin: 0;
    gap: 4px;
}

.row-number {
    width: 28px;
    min-width: 28px;
    text-align: right;
    padding-right: 4px;
    margin: 0;
    color: #88ff88;
    font-weight: bold;
}

.note-cell {
    padding: 0 4px;
    margin: 0;
    text-align: left;
    background: transparent;
    font-size: 14px;
    white-space: nowrap;
}

.row.cursor {
    background: #444466 !important;
    font-weight: bold;
}

.row.playhead {
    background: #6688aa !important;
    animation: pulse 0.5s infinite alternate;
    font-weight: bold;
}

@keyframes pulse {
    from { opacity: 0.8; }
    to { opacity: 1; }
}

#piano-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 140px;
    background: #111111;
    display: flex;
    justify-content: flex-start;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.3);
    user-select: none;
    z-index: 10;
    overflow: hidden;
}

.key { box-sizing: border-box; cursor: pointer; transition: all 0.1s ease; position: relative; }
.white { height: 140px; background: linear-gradient(to bottom, #ffffff, #f1f5f9); border: 1px solid #475569; border-radius: 0 0 8px 8px; }
.white.pressed { background: #888888; transform: translateY(2px); }
.black { width: 43px; height: 85px; background: #000000; border-radius: 0 0 5px 5px; margin: 0 -21.5px; z-index: 2; }
.black.pressed { background: #aaaaaa; }
.label { position: absolute; bottom: 8px; left: 0; width: 100%; text-align: center; font-weight: bold; font-size: 10px; pointer-events: none; }
.white .label { color: #000000; }
.black .label { color: #ffffff; bottom: 4px; font-size: 9px; }

.control-key {
    width: 35px;
    height: 30px;
    background: linear-gradient(to bottom, #e0e0e0, #c0c0c0);
    border: 2px solid #666666;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    color: #000000;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
    transition: all 0.1s ease;
    user-select: none;
}

.control-key.pressed {
    background: #888888;
    transform: translateY(2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.control-key.active {
    border-color: #ffff00;
    box-shadow: 0 0 12px rgba(255, 255, 0, 0.6);
}

.control-key span { pointer-events: none; }

#bpm-display {
    width: 35px;
    height: 30px;
    background: #000000;
    border: 2px solid #00ff00;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    color: #00ff00;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

#bpm-display span {
    pointer-events: none;
}

.octave-key {
    width: 35px;
    height: 30px;
    background: linear-gradient(to bottom, #e0e0e0, #c0c0c0);
    border: 2px solid #666666;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: #000000;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
    transition: all 0.1s ease;
    user-select: none;
    text-align: center;
}

.octave-key.pressed {
    background: #888888;
    transform: translateY(2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.octave-key span { pointer-events: none; }